diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2021-11-13 20:44:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2021-11-13 20:44:01 +0000 |
commit | be2074afba36b8c8c1452e70654ab9c6aca59e47 (patch) | |
tree | 3bad6c4b187cbb9795a71bd566e9822b37728d67 | |
parent | fcfacaad46192820c234319535df1abbbabbecbb (diff) |
Fix a nasty quirk in ASN1_STRING_copy(3).
In case of failure, it reported the failure
but corrupted the type of the destination string.
Instead, let's make sure that in case of failure,
existing objects remain in their original state.
OK tb@
-rw-r--r-- | lib/libcrypto/asn1/asn1_lib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/asn1_lib.c b/lib/libcrypto/asn1/asn1_lib.c index d760cccd4d9..b04fa3c6012 100644 --- a/lib/libcrypto/asn1/asn1_lib.c +++ b/lib/libcrypto/asn1/asn1_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_lib.c,v 1.45 2020/12/08 15:06:42 tb Exp $ */ +/* $OpenBSD: asn1_lib.c,v 1.46 2021/11/13 20:44:00 schwarze Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -290,9 +290,9 @@ ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) { if (str == NULL) return 0; - dst->type = str->type; if (!ASN1_STRING_set(dst, str->data, str->length)) return 0; + dst->type = str->type; dst->flags = str->flags; return 1; } |