summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2021-11-13 20:44:00 +0000
committerschwarze <>2021-11-13 20:44:00 +0000
commit1b90562c0e6e9d5b2104b88996ef936f5323058f (patch)
tree0a7afe103c22956d34e7400704316205aad30002 /src
parent9e7508293079fbba762cca438c5447cd8963e227 (diff)
downloadopenbsd-1b90562c0e6e9d5b2104b88996ef936f5323058f.tar.gz
openbsd-1b90562c0e6e9d5b2104b88996ef936f5323058f.tar.bz2
openbsd-1b90562c0e6e9d5b2104b88996ef936f5323058f.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')
-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}