From 942f921ba7244cdcf4574cedc4c16392a7cc594b Mon Sep 17 00:00:00 2001 From: Alberto Leiva Popper Date: Tue, 6 Aug 2024 10:35:24 -0600 Subject: [PATCH] Prevent crash on missing eContent Applies to the RouteOriginAttestation and Manifest octet strings. Thanks to Niklas Vogel for reporting this. --- src/asn1/decode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/asn1/decode.c b/src/asn1/decode.c index 1de93080..66862451 100644 --- a/src/asn1/decode.c +++ b/src/asn1/decode.c @@ -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); } /* -- 2.47.2