]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/spkac.c: Check result of ASN1_STRING_set()
authorTomas Mraz <tomas@openssl.org>
Wed, 16 Aug 2023 13:58:33 +0000 (15:58 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 18 Aug 2023 13:06:17 +0000 (15:06 +0200)
Fixes Coverity 1027256

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21755)

apps/spkac.c

index b389d9afce21632082e56e1eea6be40583f5979b..f8fa24e99a54f4816a03f0176ce08812468023d5 100644 (file)
@@ -152,9 +152,10 @@ int spkac_main(int argc, char **argv)
         spki = NETSCAPE_SPKI_new();
         if (spki == NULL)
             goto end;
-        if (challenge != NULL)
-            ASN1_STRING_set(spki->spkac->challenge,
-                            challenge, (int)strlen(challenge));
+        if (challenge != NULL
+            && !ASN1_STRING_set(spki->spkac->challenge,
+                                challenge, (int)strlen(challenge)))
+            goto end;
         if (!NETSCAPE_SPKI_set_pubkey(spki, pkey)) {
             BIO_printf(bio_err, "Error setting public key\n");
             goto end;