diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 2001-06-28 04:27:20 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 2001-06-28 04:27:20 +0000 |
commit | 51d9bd1d6a4026864be0e5ccde66fec174fc8f89 (patch) | |
tree | b55444e1a682d20a41a5a230a9abbe5be75cda48 /lib | |
parent | fc5897e34873a801e6fe167714cc7487fb99a336 (diff) |
fix one-byte overflows
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/basename.c | 6 | ||||
-rw-r--r-- | lib/libc/gen/dirname.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/gen/basename.c b/lib/libc/gen/basename.c index 9126b5a1166..7707cdb52bf 100644 --- a/lib/libc/gen/basename.c +++ b/lib/libc/gen/basename.c @@ -1,4 +1,4 @@ -/* $OpenBSD: basename.c,v 1.5 2001/06/27 00:58:54 lebel Exp $ */ +/* $OpenBSD: basename.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -28,7 +28,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: basename.c,v 1.5 2001/06/27 00:58:54 lebel Exp $"; +static char rcsid[] = "$OpenBSD: basename.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $"; #endif /* not lint */ #include <errno.h> @@ -65,7 +65,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 29c6725627a..839c785348c 100644 --- a/lib/libc/gen/dirname.c +++ b/lib/libc/gen/dirname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $ */ +/* $OpenBSD: dirname.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -28,7 +28,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $"; +static char rcsid[] = "$OpenBSD: dirname.c,v 1.6 2001/06/28 04:27:19 pjanzen Exp $"; #endif /* not lint */ #include <errno.h> @@ -68,7 +68,7 @@ dirname(path) } while (endp > path && *endp == '/'); } - if (endp - path + 1 > sizeof(bname)) { + if (endp - path + 2 > sizeof(bname)) { errno = ENAMETOOLONG; return(NULL); } |