diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lib/apps.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 2a5ec6bb65..2938e91620 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -1790,17 +1790,21 @@ int bio_to_mem(unsigned char **out, int maxlen, BIO *in) int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value) { - int rv; + int rv = 0; char *stmp, *vtmp = NULL; + stmp = OPENSSL_strdup(value); - if (!stmp) + if (stmp == NULL) return -1; vtmp = strchr(stmp, ':'); - if (vtmp) { - *vtmp = 0; - vtmp++; - } + if (vtmp == NULL) + goto err; + + *vtmp = 0; + vtmp++; rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); + + err: OPENSSL_free(stmp); return rv; } |