diff options
author | Dmitry-Me <wipedout@yandex.ru> | 2016-02-03 17:34:14 +0300 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-03 15:45:56 -0500 |
commit | a89c9a0d855bce735116acfe147b24e386f566ba (patch) | |
tree | f5ababe4be7260111f36a82b2c9dbdd4c19a2e32 /crypto/o_str.c | |
parent | 0f45c26f5ad232aa895187ce1d2b5b486d09677b (diff) |
GH614: Use memcpy()/strdup() when possible
Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'crypto/o_str.c')
-rw-r--r-- | crypto/o_str.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/o_str.c b/crypto/o_str.c index 269d60614b..b200060917 100644 --- a/crypto/o_str.c +++ b/crypto/o_str.c @@ -120,12 +120,14 @@ int OPENSSL_memcmp(const void *v1, const void *v2, size_t n) char *CRYPTO_strdup(const char *str, const char* file, int line) { char *ret; + size_t size; if (str == NULL) return NULL; - ret = CRYPTO_malloc(strlen(str) + 1, file, line); + size = strlen(str) + 1; + ret = CRYPTO_malloc(size, file, line); if (ret != NULL) - strcpy(ret, str); + memcpy(ret, str, size); return ret; } |