summaryrefslogtreecommitdiffstats
path: root/apps/spkac.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-08-16 15:58:33 +0200
committerTomas Mraz <tomas@openssl.org>2023-08-18 15:06:17 +0200
commit20baa24f9f3997a96db7cd176a6ef609afe80cea (patch)
tree3323f0524c0427f883e4ad92b9cc55577c685146 /apps/spkac.c
parent79cdbe893da0c613db97356d05c0b088e885707f (diff)
apps/spkac.c: Check result of ASN1_STRING_set()
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)
Diffstat (limited to 'apps/spkac.c')
-rw-r--r--apps/spkac.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/spkac.c b/apps/spkac.c
index b389d9afce..f8fa24e99a 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;