Fix potential infinite loop when bad ASN1 is processed.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-07-08 10:53:19 +02:00
parent eca200d2f1
commit 7e8807e054

View File

@@ -42,7 +42,7 @@ uint16_t asn1_len(asn1_ctx_t *ctx) {
uint32_t asn1_get_uint(asn1_ctx_t *ctx) {
uint32_t d = ctx->data[0];
for (uint8_t lt = 1; lt < MIN(ctx->len, sizeof(uint32_t)); lt++) {
for (uint16_t lt = 1; lt < MIN(ctx->len, sizeof(uint32_t)); lt++) {
d <<= 8;
d |= ctx->data[lt];
}