summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2018-11-28 12:16:29 +0100
committerDenys Vlasenko2018-11-28 12:16:29 +0100
commit75a1c87357070ec0229f1c98d887bc1c526bb81c (patch)
tree6305a19d436c673cd0a34e1e149c4fea00f23d11
parent572dfb8e78323b9837f7c5e3369ee233a440b8f2 (diff)
downloadbusybox-75a1c87357070ec0229f1c98d887bc1c526bb81c.zip
busybox-75a1c87357070ec0229f1c98d887bc1c526bb81c.tar.gz
awk: abort if NF set to negative value
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/awk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/editors/awk.c b/editors/awk.c
index bafc9ba..af103e3 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -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 */