Blob Blame History Raw
diff --git a/print-esp.c b/print-esp.c
index 6fabff1..5818cc8 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -242,6 +242,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
 	if (input_buffer == NULL) {
 		EVP_CIPHER_CTX_free(ctx);
 		(*ndo->ndo_error)(ndo, "can't allocate memory for encrypted data buffer");
+		return 0;
 	}
 	/*
 	 * Copy the input data to the encrypted data buffer, and pad it
@@ -259,7 +260,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
 		EVP_CIPHER_CTX_free(ctx);
 		(*ndo->ndo_error)(ndo, "can't allocate memory for decryption buffer");
 	}
-	EVP_Cipher(ctx, output_buffer, input_buffer, len);
+	EVP_Cipher(ctx, output_buffer, input_buffer, buffer_size);
 	EVP_CIPHER_CTX_free(ctx);
 
 	/*
@@ -815,6 +816,7 @@ esp_print(netdissect_options *ndo,
 			if (input_buffer == NULL) {
 				EVP_CIPHER_CTX_free(ctx);
 				(*ndo->ndo_error)(ndo, "can't allocate memory for encrypted data buffer");
+				return 0;
 			}
 			/*
 			 * Copy the input data to the encrypted data buffer,