summaryrefslogtreecommitdiffstats
path: root/lib/libc/string
diff options
context:
space:
mode:
authorpds <pds@FreeBSD.org>1997-07-26 00:47:06 +0000
committerpds <pds@FreeBSD.org>1997-07-26 00:47:06 +0000
commitfe0a77d7be46b430f03f61b1a6ec94ed2599fee8 (patch)
tree25e15530dcf52b3359f9b32b9d8a019258cca217 /lib/libc/string
parentfff17f1bd79558e58da341567a580b382cee9d0b (diff)
downloadFreeBSD-src-fe0a77d7be46b430f03f61b1a6ec94ed2599fee8.zip
FreeBSD-src-fe0a77d7be46b430f03f61b1a6ec94ed2599fee8.tar.gz
Added bounds checking to the example after chasing down someone's
broken code where they'd copied the example basically verbatim and blew an array. (engage brain before typing 'make')
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/strsep.33
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/string/strsep.3 b/lib/libc/string/strsep.3
index fd10494..7950135 100644
--- a/lib/libc/string/strsep.3
+++ b/lib/libc/string/strsep.3
@@ -86,7 +86,8 @@ char **ap, *argv[10], *inputstring;
for (ap = argv; (*ap = strsep(&inputstring, " \et")) != NULL;)
if (**ap != '\e0')
- ++ap;
+ if (++ap >= &argv[10])
+ break;
.Ed
.Sh HISTORY
The
OpenPOWER on IntegriCloud