projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add default operations to EC_METHOD
[oweals/openssl.git]
/
crypto
/
o_str.c
diff --git
a/crypto/o_str.c
b/crypto/o_str.c
index b200060917f4cbe780339f1a4bf2eac7a245527a..84005e66b57a987462c43f53b2fc156a51d38fc6 100644
(file)
--- a/
crypto/o_str.c
+++ b/
crypto/o_str.c
@@
-133,17
+133,13
@@
char *CRYPTO_strdup(const char *str, const char* file, int line)
char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
{
char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
{
- const char *cp;
size_t maxlen;
char *ret;
if (str == NULL)
return NULL;
size_t maxlen;
char *ret;
if (str == NULL)
return NULL;
- /* Get length. */
- for (cp = str, maxlen = s; maxlen-- != 0 && *cp != '\0'; ++cp)
- continue;
- maxlen = cp - str;
+ maxlen = OPENSSL_strnlen(str, s);
ret = CRYPTO_malloc(maxlen + 1, file, line);
if (ret) {
ret = CRYPTO_malloc(maxlen + 1, file, line);
if (ret) {