diff options
-rw-r--r-- | lib/libc/gen/basename.c | 2 | ||||
-rw-r--r-- | lib/libc/gen/dirname.c | 2 |
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); } |