In _gettemp(), check that the length of the path doesn't exceed
MAXPATHLEN. Otherwise the path name (or part of it) may not fit to carrybuf causing a buffer overflow. PR: bin/140228 Suggested by: jilles
This commit is contained in:
parent
9e0b98ecc5
commit
dfdee678fd
@ -116,6 +116,10 @@ _gettemp(path, doopen, domkdir, slen)
|
||||
|
||||
for (trv = path; *trv != '\0'; ++trv)
|
||||
;
|
||||
if (trv - path >= MAXPATHLEN) {
|
||||
errno = ENAMETOOLONG;
|
||||
return (0);
|
||||
}
|
||||
trv -= slen;
|
||||
suffp = trv;
|
||||
--trv;
|
||||
|
Loading…
Reference in New Issue
Block a user