summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2001-06-28 21:50:53 +0000
committerdd <dd@FreeBSD.org>2001-06-28 21:50:53 +0000
commit601dab0210e46b8eba4dbe452ba24b22ddfaf45e (patch)
tree150dc15bfe5ba692a72226867868aefb08158656 /lib
parent11cef0ec4163323d2ac95fc0b877417d080905a5 (diff)
downloadFreeBSD-src-601dab0210e46b8eba4dbe452ba24b22ddfaf45e.zip
FreeBSD-src-601dab0210e46b8eba4dbe452ba24b22ddfaf45e.tar.gz
Fix a one-byte overrun.
PR: 28472 Submitted by: David Xu <davidx@viasoft.com.cn> Obtained from: OpenBSD
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/basename.c2
-rw-r--r--lib/libc/gen/dirname.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/basename.c b/lib/libc/gen/basename.c
index b68ef3f..09998cf 100644
--- a/lib/libc/gen/basename.c
+++ b/lib/libc/gen/basename.c
@@ -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);
}
diff --git a/lib/libc/gen/dirname.c b/lib/libc/gen/dirname.c
index 5f6019e..8bc9186 100644
--- a/lib/libc/gen/dirname.c
+++ b/lib/libc/gen/dirname.c
@@ -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);
}
OpenPOWER on IntegriCloud