summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index c30b8f5b65..a4a379a9a0 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.36 2022/05/17 09:17:20 tb Exp $ */ 1/* $OpenBSD: a_bitstr.c,v 1.37 2022/11/08 16:48:28 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 *
@@ -241,6 +241,14 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
241 if (a == NULL) 241 if (a == NULL)
242 return (0); 242 return (0);
243 243
244 if (a->length == INT_MAX)
245 return (0);
246
247 ret = a->length + 1;
248
249 if (pp == NULL)
250 return (ret);
251
244 len = a->length; 252 len = a->length;
245 253
246 if (len > 0) { 254 if (len > 0) {
@@ -274,10 +282,6 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
274 } else 282 } else
275 bits = 0; 283 bits = 0;
276 284
277 ret = 1 + len;
278 if (pp == NULL)
279 return (ret);
280
281 p= *pp; 285 p= *pp;
282 286
283 *(p++) = (unsigned char)bits; 287 *(p++) = (unsigned char)bits;