Fix a one-byte overrun.
PR: 28472 Submitted by: David Xu <davidx@viasoft.com.cn> Obtained from: OpenBSD
This commit is contained in:
parent
11cef0ec41
commit
601dab0210
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user