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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c
index 1cc62eafd1..24ccf729ca 100644
--- a/src/lib/libcrypto/mem.c
+++ b/src/lib/libcrypto/mem.c
@@ -121,10 +121,10 @@ static void (*set_debug_options_func)(long) = NULL;
121static long (*get_debug_options_func)(void) = NULL; 121static long (*get_debug_options_func)(void) = NULL;
122#endif 122#endif
123 123
124
124int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), 125int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
125 void (*f)(void *)) 126 void (*f)(void *))
126 { 127 {
127 /* Dummy call just to ensure OPENSSL_init() gets linked in */
128 OPENSSL_init(); 128 OPENSSL_init();
129 if (!allow_customize) 129 if (!allow_customize)
130 return 0; 130 return 0;
@@ -326,9 +326,10 @@ void *CRYPTO_malloc(int num, const char *file, int line)
326 } 326 }
327char *CRYPTO_strdup(const char *str, const char *file, int line) 327char *CRYPTO_strdup(const char *str, const char *file, int line)
328 { 328 {
329 char *ret = CRYPTO_malloc(strlen(str)+1, file, line); 329 size_t len = strlen(str)+1;
330 char *ret = CRYPTO_malloc(len, file, line);
330 331
331 strcpy(ret, str); 332 memcpy(ret, str, len);
332 return ret; 333 return ret;
333 } 334 }
334 335