From 75a1c87357070ec0229f1c98d887bc1c526bb81c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 28 Nov 2018 12:16:29 +0100 Subject: [PATCH] awk: abort if NF set to negative value Signed-off-by: Denys Vlasenko --- editors/awk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editors/awk.c b/editors/awk.c index bafc9ba1d..af103e3cc 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 */ -- 2.25.1