From: Tomas Mraz Date: Wed, 16 Aug 2023 13:58:33 +0000 (+0200) Subject: apps/spkac.c: Check result of ASN1_STRING_set() X-Git-Tag: openssl-3.2.0-alpha1~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20baa24f9f3997a96db7cd176a6ef609afe80cea;p=thirdparty%2Fopenssl.git apps/spkac.c: Check result of ASN1_STRING_set() Fixes Coverity 1027256 Reviewed-by: Matt Caswell Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/21755) --- diff --git a/apps/spkac.c b/apps/spkac.c index b389d9afce2..f8fa24e99a5 100644 --- a/apps/spkac.c +++ b/apps/spkac.c @@ -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;