diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 52fe0eb9cd..aa854f1d7a 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.34 2022/04/23 18:56:54 jsing Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.35 2022/04/26 20:00:18 jsing 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 | * |
| @@ -291,7 +291,7 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | |||
| 291 | return (ret); | 291 | return (ret); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | static int | 294 | int |
| 295 | c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs) | 295 | c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs) |
| 296 | { | 296 | { |
| 297 | ASN1_BIT_STRING *abs = NULL; | 297 | ASN1_BIT_STRING *abs = NULL; |
| @@ -300,9 +300,14 @@ c2i_ASN1_BIT_STRING_cbs(ASN1_BIT_STRING **out_abs, CBS *cbs) | |||
| 300 | uint8_t unused_bits; | 300 | uint8_t unused_bits; |
| 301 | int ret = 0; | 301 | int ret = 0; |
| 302 | 302 | ||
| 303 | if (out_abs == NULL || *out_abs != NULL) | 303 | if (out_abs == NULL) |
| 304 | goto err; | 304 | goto err; |
| 305 | 305 | ||
| 306 | if (*out_abs != NULL) { | ||
| 307 | ASN1_BIT_STRING_free(*out_abs); | ||
| 308 | *out_abs = NULL; | ||
| 309 | } | ||
| 310 | |||
| 306 | if (!CBS_get_u8(cbs, &unused_bits)) { | 311 | if (!CBS_get_u8(cbs, &unused_bits)) { |
| 307 | ASN1error(ASN1_R_STRING_TOO_SHORT); | 312 | ASN1error(ASN1_R_STRING_TOO_SHORT); |
| 308 | goto err; | 313 | goto err; |
