iliaa Tue Jan 25 19:03:20 2005 EDT Modified files: (Branch: PHP_4_3) /php-src NEWS /php-src/ext/standard formatted_print.c Log: MFH: Fixed bug #29733 (printf() handles repeated placeholders wrong). http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.820&r2=1.1247.2.821&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.820 php-src/NEWS:1.1247.2.821 --- php-src/NEWS:1.1247.2.820 Tue Jan 25 18:42:38 2005 +++ php-src/NEWS Tue Jan 25 19:03:17 2005 @@ -46,6 +46,8 @@ in segfault). (pdan-php at esync dot org, Tony) - Fixed bug #30120 (imagettftext() and imagettfbbox() accept too many parameters). (Jani) +- Fixed bug #29733 (printf() handles repeated placeholders wrong). + (bugs dot php dot net at bluetwanger dot de, Ilia) - Fixed bug #28976 (mail(): use "From:" from headers if sendmail_from is empty). (Jani) - Fixed bug #28930 (PHP sources pick wrong header files generated by bison). http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.59.2.14&r2=1.59.2.15&ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.59.2.14 php-src/ext/standard/formatted_print.c:1.59.2.15 --- php-src/ext/standard/formatted_print.c:1.59.2.14 Mon Nov 15 08:40:31 2004 +++ php-src/ext/standard/formatted_print.c Tue Jan 25 19:03:19 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: formatted_print.c,v 1.59.2.14 2004/11/15 13:40:31 derick Exp $ */ +/* $Id: formatted_print.c,v 1.59.2.15 2005/01/26 00:03:19 iliaa Exp $ */ #include <math.h> /* modf() */ #include "php.h" @@ -536,12 +536,6 @@ 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; @@ -570,12 +564,6 @@ } else { argnum = currarg++; } - 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" @@ -631,6 +619,13 @@ argnum = currarg++; } + 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++; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php