cvs: php-src /ext/standard formatted_print.c

From: Date: Wed, 26 Jan 2005 00:01:26 +0000
Subject: cvs: php-src /ext/standard formatted_print.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-30156@lists.php.net to get a copy of this message
iliaa Tue Jan 25 19:01:26 2005 EDT Modified files: /php-src/ext/standard formatted_print.c Log: Fixed bug #29733 (printf() handles repeated placeholders wrong). # Original patch by bugs dot php dot net at bluetwanger dot de http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.80&r2=1.81&ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.80 php-src/ext/standard/formatted_print.c:1.81 --- php-src/ext/standard/formatted_print.c:1.80 Mon Nov 15 08:42:21 2004 +++ php-src/ext/standard/formatted_print.c Tue Jan 25 19:01:26 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: formatted_print.c,v 1.80 2004/11/15 13:42:21 derick Exp $ */ +/* $Id: formatted_print.c,v 1.81 2005/01/26 00:01:26 iliaa Exp $ */ #include <math.h> /* modf() */ #include "php.h" @@ -545,12 +545,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; @@ -581,13 +575,6 @@ } 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 @@ 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++; }

« previous php.cvs (#30156) next »