Fix a one-byte overrun.

PR:		28472
Submitted by:	David Xu <davidx@viasoft.com.cn>
Obtained from:	OpenBSD
This commit is contained in:
dd 2001-06-28 21:50:53 +00:00
parent 11cef0ec41
commit 601dab0210
2 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ basename(path)
while (startp > path && *(startp - 1) != '/')
startp--;
if (endp - startp + 1 > sizeof(bname)) {
if (endp - startp + 2 > sizeof(bname)) {
errno = ENAMETOOLONG;
return(NULL);
}

View File

@ -69,7 +69,7 @@ dirname(path)
} while (endp > path && *endp == '/');
}
if (endp - path + 1 > sizeof(bname)) {
if (endp - path + 2 > sizeof(bname)) {
errno = ENAMETOOLONG;
return(NULL);
}