Error from GetShortInt with negative INTEGER values - Add WORD8 case

This commit is contained in:
Josh Holtrop
2025-08-20 09:34:19 -04:00
parent 98b6b92a76
commit d2f139c9b0

View File

@@ -1283,6 +1283,13 @@ static int GetASN_StoreData(const ASNItem* asn, ASNGetData* data,
#endif
return ASN_PARSE_E;
}
if ((asn->tag != ASN_BOOLEAN) && (!zeroPadded) &&
(input[idx] >= 0x80U)) {
#ifdef WOLFSSL_DEBUG_ASN_TEMPLATE
WOLFSSL_MSG_VSNPRINTF("Unexpected negative INTEGER value");
#endif
return ASN_EXPECT_0_E;
}
/* Fill number with all of data. */
*data->data.u8 = input[idx];
break;