summaryrefslogtreecommitdiff
path: root/crypto/bytestring/cbs.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/bytestring/cbs.c')
-rw-r--r--crypto/bytestring/cbs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/bytestring/cbs.c b/crypto/bytestring/cbs.c
index 3478613..547b5a4 100644
--- a/crypto/bytestring/cbs.c
+++ b/crypto/bytestring/cbs.c
@@ -227,7 +227,8 @@ static int cbs_get_asn1_element(CBS *cbs, CBS *out, unsigned *out_tag,
const size_t num_bytes = length_byte & 0x7f;
uint32_t len32;
- if (depth < MAX_DEPTH && num_bytes == 0) {
+ if ((tag & CBS_ASN1_CONSTRUCTED) != 0 && depth < MAX_DEPTH &&
+ num_bytes == 0) {
/* indefinite length */
*out_header_len = 2;
if (was_indefinite_len) {