diff options
Diffstat (limited to 'common/compat.c')
-rw-r--r-- | common/compat.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/common/compat.c b/common/compat.c index 2548459..2cda460 100644 --- a/common/compat.c +++ b/common/compat.c @@ -459,15 +459,12 @@ strndup (const char *data, size_t length) { char *ret; - size_t len; - - len = strlen (data); - if (length > len) - length = len; - ret = memdup (data, length + 1); - if (ret != NULL) + ret = malloc (length + 1); + if (ret != NULL) { + strncpy (ret, data, length); ret[length] = 0; + } return ret; } |