checkpath: fix allocation size of path buffer

strlen's return value isn't enough to be used
directly for (x)malloc; it doesn't include
the null byte at the end of the string.

X-Gentoo-Bug: 816900
X-Gentoo-Bug-URL: https://bugs.gentoo.org/816900
Fixes: #459
Fixes: #462
This commit is contained in:
Sam James 2021-10-08 04:52:55 +01:00 committed by William Hubbs
parent 6b9a5b8271
commit bb8334104b

View File

@ -151,7 +151,7 @@ static char *clean_path(char *path)
char *ch; char *ch;
char *ch2; char *ch2;
char *str; char *str;
str = xmalloc(strlen(path)); str = xmalloc(strlen(path) + 1);
ch = path; ch = path;
ch2 = str; ch2 = str;
while (true) { while (true) {