From fe0a77d7be46b430f03f61b1a6ec94ed2599fee8 Mon Sep 17 00:00:00 2001 From: pds Date: Sat, 26 Jul 1997 00:47:06 +0000 Subject: 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') --- lib/libc/string/strsep.3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libc') 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 -- cgit v1.1