diff options
author | Tomas Mraz <tomas@openssl.org> | 2023-03-21 11:36:56 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-03-23 15:33:47 +0100 |
commit | 908ba3ed9adbb3df90f7684a3111ca916a45202d (patch) | |
tree | d1776af33ea8dcccfd5ab0d87f5ac08c6f029820 /crypto/objects | |
parent | f5935fcf8e4bc2191ac4a32e5b7ec32817642f1e (diff) |
OBJ_nid2obj(): Return UNDEF object instead of NULL for NID_undef
Fixes a regression from 3.0 from the obj creation refactoring.
Fixes #20555
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20556)
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/obj_dat.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index ad476136ae..466783d47f 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -299,9 +299,8 @@ ASN1_OBJECT *OBJ_nid2obj(int n) ADDED_OBJ ad, *adp = NULL; ASN1_OBJECT ob; - if (n == NID_undef) - return NULL; - if (n >= 0 && n < NUM_NID && nid_objs[n].nid != NID_undef) + if (n == NID_undef + || (n > 0 && n < NUM_NID && nid_objs[n].nid != NID_undef)) return (ASN1_OBJECT *)&(nid_objs[n]); ad.type = ADDED_NID; |