In 1.0.2 and before OBJ_create() allowed the sn or ln parameter to be NULL.
Commit
52832e47 changed that so that it crashed if they were NULL.
This was causing problems with the built-in config oid module. If a long
name was provided OBJ_create() is initially called with a NULL ln and
therefore causes a crash.
Fixes #3733
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3753)
int ok = 0;
/* Check to see if short or long name already present */
- if (OBJ_sn2nid(sn) != NID_undef || OBJ_ln2nid(ln) != NID_undef) {
+ if ((sn != NULL && OBJ_sn2nid(sn) != NID_undef)
+ || (ln != NULL && OBJ_ln2nid(ln) != NID_undef)) {
OBJerr(OBJ_F_OBJ_CREATE, OBJ_R_OID_EXISTS);
return 0;
}