diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2007-04-02 08:00:08 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2007-04-02 08:00:08 +0000 |
commit | e308f93242ab3516371f98ec34ad545dc613c207 (patch) | |
tree | a5a42e7fddb7fa9189bf3f55e53370e0babe0344 /usr.bin/awk | |
parent | b003f5e24740be322a995ec0279a3f8daf05ad9b (diff) |
Do not touch uninitialized variable, if sscanf(3) fails.
ok millert@
Diffstat (limited to 'usr.bin/awk')
-rw-r--r-- | usr.bin/awk/maketab.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/awk/maketab.c b/usr.bin/awk/maketab.c index 6992fa992b1..05d15b2c0e9 100644 --- a/usr.bin/awk/maketab.c +++ b/usr.bin/awk/maketab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: maketab.c,v 1.8 2004/01/15 20:01:38 deraadt Exp $ */ +/* $OpenBSD: maketab.c,v 1.9 2007/04/02 08:00:07 moritz Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) i = 0; while (fgets(buf, sizeof buf, fp) != NULL) { n = sscanf(buf, "%1c %s %s %d", &c, def, name, &tok); - if (c != '#' || n != 4 || strcmp(def,"define") != 0) + if (n != 4 || c != '#' || strcmp(def, "define") != 0) continue; /* not a valid #define */ if (tok < FIRSTTOKEN || tok > LASTTOKEN) { fprintf(stderr, "maketab: funny token %d %s ignored\n", |