summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index a4a379a9a0..767055144d 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_bitstr.c,v 1.37 2022/11/08 16:48:28 tb Exp $ */ 1/* $OpenBSD: a_bitstr.c,v 1.38 2023/01/13 14:46:08 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -255,11 +255,13 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
255 if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) { 255 if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) {
256 bits = (int)a->flags & 0x07; 256 bits = (int)a->flags & 0x07;
257 } else { 257 } else {
258 j = 0;
258 for (; len > 0; len--) { 259 for (; len > 0; len--) {
259 if (a->data[len - 1]) 260 if (a->data[len - 1])
260 break; 261 break;
261 } 262 }
262 j = a->data[len - 1]; 263 if (len > 0)
264 j = a->data[len - 1];
263 if (j & 0x01) 265 if (j & 0x01)
264 bits = 0; 266 bits = 0;
265 else if (j & 0x02) 267 else if (j & 0x02)