-/* crypto/o_str.c */
/*
* Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
* 2003.
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;
}