diff options
author | 2001-06-28 04:27:19 +0000 | |
---|---|---|
committer | 2001-06-28 04:27:19 +0000 | |
commit | cb7672e442d17e82b74e7f137bde367b5f6b89b7 (patch) | |
tree | c42eebcd56e487f297a4d1e943ff8426e28bc816 /lib/libc/gen | |
parent | add an entry for ALTQ. (diff) | |
download | wireguard-openbsd-cb7672e442d17e82b74e7f137bde367b5f6b89b7.tar.xz wireguard-openbsd-cb7672e442d17e82b74e7f137bde367b5f6b89b7.zip |
fix one-byte overflows
Diffstat (limited to 'lib/libc/gen')
-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); } |