diff options
-rw-r--r-- | src/lib/libcrypto/asn1/a_object.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index 16c3a1c0fd..8600f80474 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_object.c,v 1.31 2018/04/25 11:48:21 tb Exp $ */ | 1 | /* $OpenBSD: a_object.c,v 1.32 2021/05/01 13:16:30 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 | * |
@@ -304,8 +304,6 @@ c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long len) | |||
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
307 | /* only the ASN1_OBJECTs from the 'table' will have values | ||
308 | * for ->sn or ->ln */ | ||
309 | if ((a == NULL) || ((*a) == NULL) || | 307 | if ((a == NULL) || ((*a) == NULL) || |
310 | !((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) { | 308 | !((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) { |
311 | if ((ret = ASN1_OBJECT_new()) == NULL) | 309 | if ((ret = ASN1_OBJECT_new()) == NULL) |
@@ -327,6 +325,13 @@ c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, long len) | |||
327 | 325 | ||
328 | memcpy(data, p, length); | 326 | memcpy(data, p, length); |
329 | 327 | ||
328 | /* If there are dynamic strings, free them here, and clear the flag. */ | ||
329 | if ((ret->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) != 0) { | ||
330 | free((void *)ret->sn); | ||
331 | free((void *)ret->ln); | ||
332 | ret->flags &= ~ASN1_OBJECT_FLAG_DYNAMIC_STRINGS; | ||
333 | } | ||
334 | |||
330 | /* reattach data to object, after which it remains const */ | 335 | /* reattach data to object, after which it remains const */ |
331 | ret->data = data; | 336 | ret->data = data; |
332 | ret->length = length; | 337 | ret->length = length; |