diff options
-rw-r--r-- | lib/xwrap.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index d7b06c5a..c133125a 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -95,10 +95,9 @@ void *xrealloc(void *ptr, size_t size) // Die unless we can allocate a copy of this many bytes of string. char *xstrndup(char *s, size_t n) { - char *ret = strndup(s, ++n); + char *ret = strndup(s, n); if (!ret) error_exit("xstrndup"); - ret[--n] = 0; return ret; } |