From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from duke.felloff.net ([216.126.196.34]) by ur; Fri Jun 2 13:05:03 EDT 2017 Message-ID: Date: Fri, 2 Jun 2017 19:04:56 +0200 From: cinap_lenrek@felloff.net To: 9front@9front.org Subject: Re: [9front] /sys/src/cmd/awk/maketab.c In-Reply-To: 18572083-C7AA-422A-A995-15917DD0D103@gmail.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: object-oriented hosting GPU property control changeset: 6000:af6349c94998 tag: tip user: cinap_lenrek@felloff.net date: Fri Jun 02 19:03:37 2017 +0200 summary: awk: handle bad/incomplete input in maketab (thanks kenji arisawa) diff -r 893500fd84bc -r af6349c94998 sys/src/cmd/awk/maketab.c --- a/sys/src/cmd/awk/maketab.c Fri Jun 02 17:10:52 2017 +0200 +++ b/sys/src/cmd/awk/maketab.c Fri Jun 02 19:03:37 2017 +0200 @@ -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) { -- cinap