summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/asn1/a_string.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/a_string.c b/src/lib/libcrypto/asn1/a_string.c
index bfd2abf2f7..ca03008186 100644
--- a/src/lib/libcrypto/asn1/a_string.c
+++ b/src/lib/libcrypto/asn1/a_string.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_string.c,v 1.14 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: a_string.c,v 1.15 2023/08/15 17:38:00 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 *
@@ -119,10 +119,12 @@ ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
119 return -1; 119 return -1;
120 if ((cmp = (a->length - b->length)) != 0) 120 if ((cmp = (a->length - b->length)) != 0)
121 return cmp; 121 return cmp;
122 if ((cmp = memcmp(a->data, b->data, a->length)) != 0) 122 if (a->length != 0) {
123 return cmp; 123 if ((cmp = memcmp(a->data, b->data, a->length)) != 0)
124 return 0;
125 }
124 126
125 return (a->type - b->type); 127 return a->type - b->type;
126} 128}
127LCRYPTO_ALIAS(ASN1_STRING_cmp); 129LCRYPTO_ALIAS(ASN1_STRING_cmp);
128 130