[git commit] awk: abort if NF set to negative value

Denys Vlasenko vda.linux at googlemail.com
Wed Nov 28 11:16:29 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=75a1c87357070ec0229f1c98d887bc1c526bb81c
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 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 */


More information about the busybox-cvs mailing list