From 8b580b63cfdba3a6d9982f38ba048b023e1d6054 Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Sat, 13 Nov 2021 20:44:00 +0000 Subject: 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@ --- src/lib/libcrypto/asn1/asn1_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') 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 @@ -/* $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; } -- cgit v1.2.3-55-g6feb