diff options
author | Kurt Cancemi <kurt@x64architecture.com> | 2016-05-26 16:38:31 -0400 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-06-08 15:30:03 +0100 |
commit | 01d0e241dc4184a5a1f222f8eccdad11da12305a (patch) | |
tree | 767c5e1b25946fb6bb43cc1d17df9bdedf091fba /crypto | |
parent | e2bb9b9bf355792d89e131518cc0fd141d46ca5c (diff) |
crypto/x509/x509_vpm.c: Simplify int_x509_param_set1()
This change also avoids calling strlen twice when srclen is 0
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509/x509_vpm.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c index f7ecdec8c5..194d09b366 100644 --- a/crypto/x509/x509_vpm.c +++ b/crypto/x509/x509_vpm.c @@ -259,12 +259,11 @@ static int int_x509_param_set1(char **pdest, size_t *pdestlen, { void *tmp; if (src) { - if (srclen == 0) { - tmp = OPENSSL_strdup(src); + if (srclen == 0) srclen = strlen(src); - } else - tmp = OPENSSL_memdup(src, srclen); - if (!tmp) + + tmp = OPENSSL_memdup(src, srclen); + if (tmp == NULL) return 0; } else { tmp = NULL; @@ -272,7 +271,7 @@ static int int_x509_param_set1(char **pdest, size_t *pdestlen, } OPENSSL_free(*pdest); *pdest = tmp; - if (pdestlen) + if (pdestlen != NULL) *pdestlen = srclen; return 1; } |