Skip to content

Commit 3bf3dff

Browse files
committed
signal a potential overflow when decoding a LTC_ASN1_SHORT_INTEGER
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 8899c81 commit 3bf3dff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/pk/asn1/der/short_integer/der_decode_short_integer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ int der_decode_short_integer(const unsigned char *in, unsigned long inlen, unsig
4242
return CRYPT_INVALID_PACKET;
4343
}
4444

45+
if (len > sizeof(unsigned long)) {
46+
return CRYPT_OVERFLOW;
47+
}
48+
4549
/* read number */
4650
y = 0;
4751
while (len--) {

0 commit comments

Comments
 (0)