diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index 0bd8a611eb83c99aad01fcee01143bbaad490845..fef5d2e114be1eef73b78653ce84a915da3e59d3 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c @@ -284,6 +284,9 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder, if (unlikely(len > datalen - dp)) goto data_overrun_error; } + } else { + if (unlikely(len > datalen - dp)) + goto data_overrun_error; } if (flags & FLAG_CONS) {