From fc3af1e0ec75eaf53f436e45edde4cb56f16cbb6 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Mon, 1 Sep 2025 14:03:29 +0200 Subject: [PATCH] A BitString of length 0 can be only 3bytes long Signed-off-by: Steffen Jaeckel --- src/pk/asn1/der/bit/der_decode_bit_string.c | 4 ++-- src/pk/asn1/der/bit/der_decode_raw_bit_string.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pk/asn1/der/bit/der_decode_bit_string.c b/src/pk/asn1/der/bit/der_decode_bit_string.c index 83c915dc..3e6de501 100644 --- a/src/pk/asn1/der/bit/der_decode_bit_string.c +++ b/src/pk/asn1/der/bit/der_decode_bit_string.c @@ -28,8 +28,8 @@ int der_decode_bit_string(const unsigned char *in, unsigned long inlen, LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); - /* packet must be at least 4 bytes */ - if (inlen < 4) { + /* packet must be at least 3 bytes */ + if (inlen < 3) { return CRYPT_INVALID_ARG; } diff --git a/src/pk/asn1/der/bit/der_decode_raw_bit_string.c b/src/pk/asn1/der/bit/der_decode_raw_bit_string.c index 1bc74f60..d23c8978 100644 --- a/src/pk/asn1/der/bit/der_decode_raw_bit_string.c +++ b/src/pk/asn1/der/bit/der_decode_raw_bit_string.c @@ -31,8 +31,8 @@ int der_decode_raw_bit_string(const unsigned char *in, unsigned long inlen, LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); - /* packet must be at least 4 bytes */ - if (inlen < 4) { + /* packet must be at least 3 bytes */ + if (inlen < 3) { return CRYPT_INVALID_ARG; }