]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ocspapitest: properly check the return of memory-allocating functions
authorxkernel <xkernel.wang@foxmail.com>
Mon, 11 Jul 2022 07:12:00 +0000 (15:12 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 14 Jul 2022 12:08:51 +0000 (14:08 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18774)

test/ocspapitest.c

index 9e8c30625996a0c17b36c0286472e8a21ae06d28..7142f50831ef3cd9f58d33aa5ea4f64c2b2f467b 100644 (file)
@@ -78,7 +78,10 @@ static OCSP_BASICRESP *make_dummy_resp(void)
     ASN1_BIT_STRING *key = ASN1_BIT_STRING_new();
     ASN1_INTEGER *serial = ASN1_INTEGER_new();
 
-    if (!X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_ASC,
+    if (!TEST_ptr(name)
+        || !TEST_ptr(key)
+        || !TEST_ptr(serial)
+        || !X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_ASC,
                                    namestr, -1, -1, 1)
         || !ASN1_BIT_STRING_set(key, keybytes, sizeof(keybytes))
         || !ASN1_INTEGER_set_uint64(serial, (uint64_t)1))