commit 328f45d5dcadced32eaeee1ea0a6f05f7cb2a969
parent fe3c00a2d48a2f6d7d66231cb5edecb0c5ccf778
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 15 Apr 2014 20:51:47 +0200
Copy end of string in xstrdup
the size of a string is length of the string + 1 due to the
end of string.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wrapper.c b/wrapper.c
@@ -36,7 +36,7 @@ xcalloc(size_t nmemb, size_t size)
char *
xstrdup(const char *s)
{
- register size_t len = strlen(s);
+ register size_t len = strlen(s) + 1;
register char *p = xmalloc(len);
return memcpy(p, s, len);