Fix buffer overrun in glob tilde expansion

Similar to 8dda888e14 but this one
noticed by covscan: not enough space for the terminating \0.
This commit is contained in:
Panu Matilainen 2018-10-10 11:31:49 +03:00
parent ff3d8ac2e5
commit fa10245c91
1 changed files with 1 additions and 1 deletions

View File

@ -314,7 +314,7 @@ glob(const char *pattern, int flags,
else {
char *newp;
size_t home_len = strlen(home_dir);
newp = (char *) alloca(home_len + dirlen);
newp = (char *) alloca(home_len + dirlen + 1);
mempcpy(mempcpy(newp, home_dir, home_len),
&dirname[1], dirlen);
dirname = newp;