summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2021-11-13 20:44:00 +0000
committerschwarze <>2021-11-13 20:44:00 +0000
commit8b580b63cfdba3a6d9982f38ba048b023e1d6054 (patch)
tree0a7afe103c22956d34e7400704316205aad30002 /src/lib
parent008ce6e9d0e664052a6b5a3dfc6c9292f4a90432 (diff)
downloadopenbsd-8b580b63cfdba3a6d9982f38ba048b023e1d6054.tar.gz
openbsd-8b580b63cfdba3a6d9982f38ba048b023e1d6054.tar.bz2
openbsd-8b580b63cfdba3a6d9982f38ba048b023e1d6054.zip
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@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index d760cccd4d..b04fa3c601 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_lib.c,v 1.45 2020/12/08 15:06:42 tb Exp $ */ 1/* $OpenBSD: asn1_lib.c,v 1.46 2021/11/13 20:44:00 schwarze 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 *
@@ -290,9 +290,9 @@ ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
290{ 290{
291 if (str == NULL) 291 if (str == NULL)
292 return 0; 292 return 0;
293 dst->type = str->type;
294 if (!ASN1_STRING_set(dst, str->data, str->length)) 293 if (!ASN1_STRING_set(dst, str->data, str->length))
295 return 0; 294 return 0;
295 dst->type = str->type;
296 dst->flags = str->flags; 296 dst->flags = str->flags;
297 return 1; 297 return 1;
298} 298}