[Bug 11516] Awk segfault if NF is negative

bugzilla at busybox.net bugzilla at busybox.net
Wed Nov 21 16:08:53 UTC 2018


https://bugs.busybox.net/show_bug.cgi?id=11516

--- Comment #1 from Ron Yorston <rmy at pobox.com> ---
In the same situation GNU awk terminates with the message:

   awk: cmd. line:1: (FILENAME=- FNR=1) fatal: NF set to negative value

We could to something similar by adding a couple of lines to the function
handle_special in editors/awk.c:

    if (v == intvar[NF]) {
        n = (int)getvar_i(v);
+       if (n < 0)
+           syntax_error("NF set to negative value");
        fsrealloc(n);

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list