]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Prevent crash on missing eContent
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 6 Aug 2024 16:35:24 +0000 (10:35 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 6 Aug 2024 16:35:24 +0000 (10:35 -0600)
Applies to the RouteOriginAttestation and Manifest octet strings.

Thanks to Niklas Vogel for reporting this.

src/asn1/decode.c

index 1de93080e081b7f39f0d7e0a3b938cdda53bfb6e..66862451858dae22d843a0672f4482ccf5e75317 100644 (file)
@@ -65,14 +65,18 @@ int
 asn1_decode_any(ANY_t *any, asn_TYPE_descriptor_t const *descriptor,
     void **result, bool log)
 {
-       return asn1_decode(any->buf, any->size, descriptor, result, log);
+       return (any != NULL)
+           ? asn1_decode(any->buf, any->size, descriptor, result, log)
+           : pr_val_err("ANY '%s' is NULL.", descriptor->name);
 }
 
 int
 asn1_decode_octet_string(OCTET_STRING_t *string,
     asn_TYPE_descriptor_t const *descriptor, void **result, bool log)
 {
-       return asn1_decode(string->buf, string->size, descriptor, result, log);
+       return (string != NULL)
+           ? asn1_decode(string->buf, string->size, descriptor, result, log)
+           : pr_val_err("Octet String '%s' is NULL.", descriptor->name);
 }
 
 /*