aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/string.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/core/string.c b/src/core/string.c
index 190007a4..e53c283c 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -337,11 +337,9 @@ void * memchr(const void *s, int c, size_t n)
char * strndup(const char *s, size_t n)
{
- size_t len = strlen(s);
+ size_t len = strnlen(s,n);
char *new;
- if (len>n)
- len = n;
new = malloc(len+1);
if (new) {
new[len] = '\0';