diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | builtin.c | 9 |
2 files changed, 10 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2013-02-06 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (printf_common): Move nargs > 0 check into assert. + (do_sprintf): Add nargs check and fatal message to here. + 2013-01-31 Arnold D. Robbins <arnold@skeeve.com> * regcomp.c, regex.c, regex_internal.c, regexec.c: Update @@ -1392,10 +1392,7 @@ printf_common(int nargs) int i; NODE *r, *tmp; - if (nargs == 0) - fatal(_("[s]printf called with no arguments")); - - assert(nargs <= max_args); + assert(nargs > 0 && nargs <= max_args); for (i = 1; i <= nargs; i++) { tmp = args_array[nargs - i] = POP(); if (tmp->type == Node_var_array) { @@ -1418,6 +1415,10 @@ NODE * do_sprintf(int nargs) { NODE *r; + + if (nargs == 0) + fatal(_("sprintf: no arguments")); + r = printf_common(nargs); if (r == NULL) gawk_exit(EXIT_FATAL); |