summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/mem.c')
-rw-r--r--src/lib/libcrypto/mem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c
index 6f80dd33eb..8f06d190a1 100644
--- a/src/lib/libcrypto/mem.c
+++ b/src/lib/libcrypto/mem.c
@@ -324,9 +324,10 @@ void *CRYPTO_malloc(int num, const char *file, int line)
324 } 324 }
325char *CRYPTO_strdup(const char *str, const char *file, int line) 325char *CRYPTO_strdup(const char *str, const char *file, int line)
326 { 326 {
327 char *ret = CRYPTO_malloc(strlen(str)+1, file, line); 327 size_t len = strlen(str)+1;
328 char *ret = CRYPTO_malloc(len, file, line);
328 329
329 strcpy(ret, str); 330 memcpy(ret, str, len);
330 return ret; 331 return ret;
331 } 332 }
332 333