Commit: 4a391eeaec3cf22c21c427adadc092d8ad71fe27
Parent: f2489e0990363abb3b0ac20324d7b76e8367c9c0
Author: Randy Palamar
Date: Sat, 28 Oct 2023 22:36:20 -0600
xmemdup(): actually add extra byte for NUL
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util.c b/util.c
@@ -67,7 +67,7 @@ xmemdup(void *src, ptrdiff_t len)
char *p;
if (len < 0)
die("xmemdup(): negative len\n");
- p = xreallocarray(NULL, 1, len);
+ p = xreallocarray(NULL, 1, len + 1);
p[len] = 0;
return memcpy(p, src, len);
}