diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-09-22 23:39:25 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-09-22 23:39:25 +0000 |
commit | 0e6f6c187d7a36cc93d441be83105cabf30edd5d (patch) | |
tree | 318da8605e24fc5d716dba23c8da405fe95905bc /usr.bin/tsort | |
parent | 24855bdb7a15be0fa25094e02cfeb9b4cbd54728 (diff) |
Fix read beyond end of buffer, found by mallocguard. ok deraadt@ espie@
Diffstat (limited to 'usr.bin/tsort')
-rw-r--r-- | usr.bin/tsort/tsort.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c index 9cbd325ac94..383e16d8cf6 100644 --- a/usr.bin/tsort/tsort.c +++ b/usr.bin/tsort/tsort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsort.c,v 1.16 2003/06/10 22:20:53 deraadt Exp $ */ +/* $OpenBSD: tsort.c,v 1.17 2003/09/22 23:39:24 drahn Exp $ */ /* ex:ts=8 sw=4: */ @@ -326,11 +326,11 @@ read_pairs(FILE *f, struct ohash *h, int reverse, const char *name, for (;;) { char *e; - while (isspace(*str) && str < sentinel) + while (str < sentinel && isspace(*str)) str++; if (str == sentinel) break; - for (e = str; !isspace(*e) && e < sentinel; e++) + for (e = str; e < sentinel && !isspace(*e); e++) continue; if (toggle) { a = node_lookup(h, str, e); @@ -374,11 +374,11 @@ read_hints(FILE *f, struct ohash *h, int quiet, const char *name, char *e; struct node *a; - while (isspace(*str) && str < sentinel) + while (str < sentinel && isspace(*str)) str++; if (str == sentinel) break; - for (e = str; !isspace(*e) && e < sentinel; e++) + for (e = str; e < sentinel && !isspace(*e); e++) continue; a = node_lookup(h, str, e); if (a->order != NO_ORDER) { |