awk: abort if NF set to negative value
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 28 Nov 2018 11:16:29 +0000 (12:16 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 28 Nov 2018 11:16:29 +0000 (12:16 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
editors/awk.c

index bafc9ba1d382b6bbb2651469aefd12b1161625b5..af103e3cc741c08f708c1df0513f3875b233ff25 100644 (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 */