Skip to contentSkip to conversation

libimaevm: do not crash if the certificate cannot be read

PATCH In review Alberto Mardegan 3 participants 3 messages Dec 20, 2022 – Jan 9, 2023 Keys-trusted

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libimaevm: do not crash if the certificate cannot be read

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.

---
 src/libimaevm.c | 1 +
 1 file changed, 1 insertion(+)
src/libimaevm.c +1 -0
index c09ed98..5b22462 100644
@@ -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))) {
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 5 lines · Alberto Mardegan

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.

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

thanks,

Mimi

#2 lore raw

PATCH 1/1 libimaevm: do not crash if the certificate cannot be read

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.

---
 src/libimaevm.c | 1 +
 1 file changed, 1 insertion(+)
src/libimaevm.c +1 -0
index c09ed98..5b22462 100644
@@ -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))) {
Signature · 1 line
2.34.1