Don't accept 0-length ASN.1 integers for decoding

This commit is contained in:
Isaac Klein 2024-08-21 14:02:26 -04:00
parent 9c413abee1
commit 3fb7bd92cc

View File

@ -1020,7 +1020,7 @@ static size_t WinPrAsn1DecReadIntegerLike(WinPrAsn1Decoder* dec, WinPrAsn1_tag e
size_t ret = readTagAndLen(dec, &dec->source, &tag, &len);
if (!ret || (tag != expectedTag))
return 0;
if (!Stream_CheckAndLogRequiredLength(TAG, &dec->source, len) || (len > 4))
if (len == 0 || !Stream_CheckAndLogRequiredLength(TAG, &dec->source, len) || (len > 4))
return 0;
WinPrAsn1_INTEGER val = 0;