Skip to content

Commit 28fc862

Browse files
committed
A BitString of length 0 can be only 3bytes long
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 6c751f5 commit 28fc862

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/pk/asn1/der/bit/der_decode_bit_string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ int der_decode_bit_string(const unsigned char *in, unsigned long inlen,
2828
LTC_ARGCHK(out != NULL);
2929
LTC_ARGCHK(outlen != NULL);
3030

31-
/* packet must be at least 4 bytes */
32-
if (inlen < 4) {
31+
/* packet must be at least 3 bytes */
32+
if (inlen < 3) {
3333
return CRYPT_INVALID_ARG;
3434
}
3535

src/pk/asn1/der/bit/der_decode_raw_bit_string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ int der_decode_raw_bit_string(const unsigned char *in, unsigned long inlen,
3131
LTC_ARGCHK(out != NULL);
3232
LTC_ARGCHK(outlen != NULL);
3333

34-
/* packet must be at least 4 bytes */
35-
if (inlen < 4) {
34+
/* packet must be at least 3 bytes */
35+
if (inlen < 3) {
3636
return CRYPT_INVALID_ARG;
3737
}
3838

0 commit comments

Comments
 (0)