ref: 178e05f9b7dd9c7c47b9c575fdb151853e267867
parent: ea413b4a62be9993e4b63bf237f0b1d482f4aafa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jun 2 15:03:37 EDT 2017
awk: handle bad/incomplete input in maketab (thanks kenji arisawa)
--- a/sys/src/cmd/awk/maketab.c
+++ b/sys/src/cmd/awk/maketab.c
@@ -133,8 +133,8 @@
i = 0;
while ((buf = Brdline(fp, '\n')) != nil) {
buf[Blinelen(fp)-1] = '\0';
- tokenize(buf, toks, 3);
- if (toks[0] == nil || strcmp("#define", toks[0]) != 0) /* not a valid #define */
+ if (tokenize(buf, toks, 3) != 3
+ || strcmp("#define", toks[0]) != 0) /* not a valid #define */
continue;
tok = strtol(toks[2], nil, 10);
if (tok < FIRSTTOKEN || tok > LASTTOKEN) {