Check ASN1_OBJECT_new result
authorDrokov Pavel <drokov@rutoken.ru>
Thu, 11 Jan 2024 23:51:15 +0000 (18:51 -0500)
committerTomas Mraz <tomas@openssl.org>
Mon, 15 Jan 2024 09:43:44 +0000 (10:43 +0100)
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23270)

crypto/objects/obj_dat.c

index b0e1032ec2cf859caa026fb0b2fa8a71ca29d304..ebde56247761c780cc54abbd6951ccf180c1d42b 100644 (file)
@@ -790,6 +790,10 @@ int OBJ_create(const char *oid, const char *sn, const char *ln)
     } else {
         /* Create a no-OID ASN1_OBJECT */
         tmpoid = ASN1_OBJECT_new();
+        if (tmpoid == NULL) {
+            ERR_raise(ERR_LIB_OBJ, ERR_R_ASN1_LIB);
+            return 0;
+        }
     }
 
     if (!ossl_obj_write_lock(1)) {