aboutsummaryrefslogtreecommitdiff
path: root/run.c
diff options
context:
space:
mode:
authorCody Peter Mello <melloc@writev.io>2018-09-14 17:29:06 -0700
committerCody Peter Mello <melloc@writev.io>2018-09-14 17:34:17 -0700
commit6cf37e9d15c15a3ba5f5c93c05e2fcafc35a2338 (patch)
tree3c2f29edf927ee09f766f7909746e668363dc7b8 /run.c
parent2dc7e5ff1a4feeeb549f32706cf34e17aba89192 (diff)
downloadone-true-awk-6cf37e9d15c15a3ba5f5c93c05e2fcafc35a2338.tar.gz
Check for format character precision argument before using it
Diffstat (limited to 'run.c')
-rw-r--r--run.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/run.c b/run.c
index 81b75da..95380ef 100644
--- a/run.c
+++ b/run.c
@@ -863,6 +863,9 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
FATAL("'$' not permitted in awk formats");
}
if (*s == '*') {
+ if (a == NULL) {
+ FATAL("not enough args in printf(%s)", os);
+ }
x = execute(a);
a = a->nnext;
sprintf(t-1, "%d", fmtwd=(int) getfval(x));