diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 457f526e71..f89d8e1c24 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_dec.c,v 1.80 2022/09/03 18:52:18 jsing Exp $ */ | 1 | /* $OpenBSD: tasn_dec.c,v 1.81 2022/09/03 19:11:45 jsing Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -276,7 +276,7 @@ asn1_find_end(CBS *cbs, size_t length, int indefinite) | |||
| 276 | static int | 276 | static int |
| 277 | asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) | 277 | asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) |
| 278 | { | 278 | { |
| 279 | ASN1_STRING *stmp; | 279 | ASN1_STRING *astr; |
| 280 | ASN1_BOOLEAN *tbool; | 280 | ASN1_BOOLEAN *tbool; |
| 281 | uint8_t u8val; | 281 | uint8_t u8val; |
| 282 | int ret = 0; | 282 | int ret = 0; |
| @@ -361,21 +361,19 @@ asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM * | |||
| 361 | } | 361 | } |
| 362 | } | 362 | } |
| 363 | /* All based on ASN1_STRING and handled the same way. */ | 363 | /* All based on ASN1_STRING and handled the same way. */ |
| 364 | if (*pval == NULL) { | 364 | if (*pval != NULL) { |
| 365 | if ((stmp = ASN1_STRING_type_new(utype)) == NULL) { | 365 | ASN1_STRING_free((ASN1_STRING *)*pval); |
| 366 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 367 | goto err; | ||
| 368 | } | ||
| 369 | *pval = (ASN1_VALUE *)stmp; | ||
| 370 | } else { | ||
| 371 | stmp = (ASN1_STRING *)*pval; | ||
| 372 | stmp->type = utype; | ||
| 373 | } | ||
| 374 | if (!ASN1_STRING_set(stmp, CBS_data(content), CBS_len(content))) { | ||
| 375 | ASN1_STRING_free(stmp); | ||
| 376 | *pval = NULL; | 366 | *pval = NULL; |
| 367 | } | ||
| 368 | if ((astr = ASN1_STRING_type_new(utype)) == NULL) { | ||
| 369 | ASN1error(ERR_R_MALLOC_FAILURE); | ||
| 370 | goto err; | ||
| 371 | } | ||
| 372 | if (!ASN1_STRING_set(astr, CBS_data(content), CBS_len(content))) { | ||
| 373 | ASN1_STRING_free(astr); | ||
| 377 | goto err; | 374 | goto err; |
| 378 | } | 375 | } |
| 376 | *pval = (ASN1_VALUE *)astr; | ||
| 379 | break; | 377 | break; |
| 380 | } | 378 | } |
| 381 | 379 | ||
