diff options
author | tb <> | 2020-12-08 15:06:42 +0000 |
---|---|---|
committer | tb <> | 2020-12-08 15:06:42 +0000 |
commit | c764eafb939abec0dbc6a7426ed485858a02301b (patch) | |
tree | 21666fa07453516b9358a615a663acd5584cebc9 /src/lib/libcrypto/asn1/asn1_lib.c | |
parent | 25c0e0c068c2980a1072e94e88a250efba150a09 (diff) | |
download | openbsd-c764eafb939abec0dbc6a7426ed485858a02301b.tar.gz openbsd-c764eafb939abec0dbc6a7426ed485858a02301b.tar.bz2 openbsd-c764eafb939abec0dbc6a7426ed485858a02301b.zip |
Fix a NULL dereference in GENERAL_NAME_cmp()
Comparing two GENERAL_NAME structures containing an EDIPARTYNAME can lead
to a crash. This enables a denial of service attack for an attacker who can
control both sides of the comparison.
Issue reported to OpenSSL on Nov 9 by David Benjamin.
OpenSSL shared the information with us on Dec 1st.
Fix from Matt Caswell (OpenSSL) with a few small tweaks.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1_lib.c')
-rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 5dc520c428..d760cccd4d 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.44 2018/11/17 09:34:11 tb Exp $ */ | 1 | /* $OpenBSD: asn1_lib.c,v 1.45 2020/12/08 15:06:42 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 | * |
@@ -388,6 +388,8 @@ ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | |||
388 | { | 388 | { |
389 | int i; | 389 | int i; |
390 | 390 | ||
391 | if (a == NULL || b == NULL) | ||
392 | return -1; | ||
391 | i = (a->length - b->length); | 393 | i = (a->length - b->length); |
392 | if (i == 0) { | 394 | if (i == 0) { |
393 | i = memcmp(a->data, b->data, a->length); | 395 | i = memcmp(a->data, b->data, a->length); |