diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-01-26 00:01:26 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-01-26 00:01:26 +0000 |
commit | c85a9abc4ceb2b296cb07ccd1ab38b2be6eb0951 (patch) | |
tree | 3e7b9431b0f625474537e81c6cff0f7354e6be01 | |
parent | 9ab8deb33cd39e45e0bf7419b44519eecb73e8c6 (diff) | |
download | php-git-c85a9abc4ceb2b296cb07ccd1ab38b2be6eb0951.tar.gz |
Fixed bug #29733 (printf() handles repeated placeholders wrong).
# Original patch by bugs dot php dot net at bluetwanger dot de
-rw-r--r-- | ext/standard/formatted_print.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 75cf0205d8..8119ce2f90 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -545,12 +545,6 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC php_sprintf_appendchar(&result, &outpos, &size, '%' TSRMLS_CC); inpos += 2; } else { - if (currarg >= argc && format[inpos + 1] != '%') { - efree(result); - efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too few arguments"); - return NULL; - } /* starting a new format specifier, reset variables */ alignment = ALIGN_RIGHT; adjusting = 0; @@ -581,13 +575,6 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC } argnum += format_offset; - - if (argnum >= argc) { - efree(result); - efree(args); - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too few arguments"); - return NULL; - } /* after argnum comes modifiers */ PRINTF_DEBUG(("sprintf: looking for modifiers\n" @@ -643,6 +630,13 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC argnum = currarg++ + format_offset; } + if (argnum >= argc) { + efree(result); + efree(args); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too few arguments"); + return NULL; + } + if (format[inpos] == 'l') { inpos++; } |