summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/settings.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/settings.c b/src/settings.c
index 02c8e8d..aa256c5 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -13,7 +13,11 @@ char * strndup(const char *s, size_t n)
size_t len;
char *buf;
- len = MIN(strlen(s), n);
+ for (len = 0; len < n; len++) {
+ if (!s[len])
+ break;
+ }
+
buf = calloc(len + 1, sizeof(char));
if (!buf)
return NULL;
© All Rights Reserved