diff options
author | Pauli <pauli@openssl.org> | 2023-04-27 10:54:38 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-05-01 17:14:42 +1000 |
commit | 0feb90ba6093a59dcea0279d699169f604600d49 (patch) | |
tree | 148676b8787c439570435e7062037255fd5c74d3 /crypto/asn1/a_strnid.c | |
parent | b5a635dc2113e1bc807ea358a670146c813df989 (diff) |
asn1: sort stacks before using find
a_strnid.c doesn't have a lock for the sort. This is no worse than the
existing code which sorted silently without a lock.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/20842)
Diffstat (limited to 'crypto/asn1/a_strnid.c')
-rw-r--r-- | crypto/asn1/a_strnid.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c index 869ac82714..998468f846 100644 --- a/crypto/asn1/a_strnid.c +++ b/crypto/asn1/a_strnid.c @@ -133,7 +133,9 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL); fnd.nid = nid; - if (stable) { + if (stable != NULL) { + /* Ideally, this would be done under lock */ + sk_ASN1_STRING_TABLE_sort(stable); idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); if (idx >= 0) return sk_ASN1_STRING_TABLE_value(stable, idx); |