cvs: php4 /ext/standard formatted_print.c

From: Date: Fri, 22 Mar 2002 09:09:18 +0000
Subject: cvs: php4 /ext/standard formatted_print.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10574@lists.php.net to get a copy of this message
derick Fri Mar 22 04:09:18 2002 EDT Modified files: /php4/ext/standard formatted_print.c Log: - Fix handling of zero'th argument for sprintf()'s argument swapping code (Patch by Morten Poulsen <morten@afdelingp.dk>) Index: php4/ext/standard/formatted_print.c diff -u php4/ext/standard/formatted_print.c:1.46 php4/ext/standard/formatted_print.c:1.47 --- php4/ext/standard/formatted_print.c:1.46 Thu Feb 28 03:26:45 2002 +++ php4/ext/standard/formatted_print.c Fri Mar 22 04:09:18 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: formatted_print.c,v 1.46 2002/02/28 08:26:45 sebastian Exp $ */ +/* $Id: formatted_print.c,v 1.47 2002/03/22 09:09:18 derick Exp $ */ #include <math.h> /* modf() */ #include "php.h" @@ -480,6 +480,14 @@ while (isdigit((int)format[temppos])) temppos++; if (format[temppos] == '$') { argnum = php_sprintf_getnumber(format, &inpos); + + if (argnum == 0) { + efree(result); + efree(args); + php_error(E_WARNING, "%s(): zero is not a valid argument number", get_active_function_name(TSRMLS_C)); + return NULL; + } + inpos++; /* skip the '$' */ } else { argnum = currarg++;

« previous php.cvs (#10574) next »