diff mbox series

libimaevm: do not crash if the certificate cannot be read

Message ID 20221220120741.150456-1-a.mardegan@omp.ru (mailing list archive)
State New, archived
Headers show
Series libimaevm: do not crash if the certificate cannot be read | expand

Commit Message

Alberto Mardegan Dec. 20, 2022, 12:07 p.m. UTC
This code path can be triggered if someone inadvertedly swaps the key
with the certificate in the evmctl command line. Our `x` variable would
be NULL, and we need to abort further processing of the certificate.

Signed-off-by: Alberto Mardegan <a.mardegan@omp.ru>
---
 src/libimaevm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mimi Zohar Jan. 2, 2023, 2:10 p.m. UTC | #1
On Tue, 2022-12-20 at 15:07 +0300, Alberto Mardegan wrote:
> This code path can be triggered if someone inadvertedly swaps the key
> with the certificate in the evmctl command line. Our `x` variable would
> be NULL, and we need to abort further processing of the certificate.
> 
> Signed-off-by: Alberto Mardegan <a.mardegan@omp.ru>

Hi Alberto, any chance you could fix the email address mismatch?

thanks,

Mimi
diff mbox series

Patch

diff --git a/src/libimaevm.c b/src/libimaevm.c
index c09ed98..5b22462 100644
--- a/src/libimaevm.c
+++ b/src/libimaevm.c
@@ -923,6 +923,7 @@  static int read_keyid_from_cert(uint32_t *keyid_be, const char *certfile, int tr
 		ERR_print_errors_fp(stderr);
 		log_err("read keyid: %s: Error reading x509 certificate\n",
 			certfile);
+		return -1;
 	}
 
 	if (!(skid = x509_get_skid(x, &skid_len))) {