GH614: Use memcpy()/strdup() when possible

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 269d606..b200060 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -120,12 +120,14 @@
 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;
 }