awk: abort if NF set to negative value

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-11-28 12:16:29 +01:00
parent 572dfb8e78
commit 75a1c87357

View File

@ -1849,6 +1849,8 @@ static void handle_special(var *v)
if (v == intvar[NF]) {
n = (int)getvar_i(v);
if (n < 0)
syntax_error("NF set to negative value");
fsrealloc(n);
/* recalculate $0 */