summaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-05-13 08:15:58 +0100
committerRon Yorston <rmy@pobox.com>2018-05-13 08:15:58 +0100
commit3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d (patch)
treea527d0db15f34a137fc11df5538c7f2f7c6d72de /editors/awk.c
parent6f7d1af269eed4b42daeb9c6dfd2ba62f9cd47e4 (diff)
parentd80eecb86812c1fbda652f9b995060c26ba0b155 (diff)
downloadbusybox-w32-3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d.tar.gz
busybox-w32-3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d.tar.bz2
busybox-w32-3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 9d74d931d..b9c8d2130 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -598,6 +598,7 @@ static const char EMSG_NOT_ARRAY[] ALIGN1 = "Not an array";
598static const char EMSG_POSSIBLE_ERROR[] ALIGN1 = "Possible syntax error"; 598static const char EMSG_POSSIBLE_ERROR[] ALIGN1 = "Possible syntax error";
599static const char EMSG_UNDEF_FUNC[] ALIGN1 = "Call to undefined function"; 599static const char EMSG_UNDEF_FUNC[] ALIGN1 = "Call to undefined function";
600static const char EMSG_NO_MATH[] ALIGN1 = "Math support is not compiled in"; 600static const char EMSG_NO_MATH[] ALIGN1 = "Math support is not compiled in";
601static const char EMSG_NEGATIVE_FIELD[] ALIGN1 = "Access to negative field";
601 602
602static void zero_out_var(var *vp) 603static void zero_out_var(var *vp)
603{ 604{
@@ -2953,6 +2954,8 @@ static var *evaluate(node *op, var *res)
2953 2954
2954 case XC( OC_FIELD ): { 2955 case XC( OC_FIELD ): {
2955 int i = (int)getvar_i(R.v); 2956 int i = (int)getvar_i(R.v);
2957 if (i < 0)
2958 syntax_error(EMSG_NEGATIVE_FIELD);
2956 if (i == 0) { 2959 if (i == 0) {
2957 res = intvar[F0]; 2960 res = intvar[F0];
2958 } else { 2961 } else {