From: Stanislav Malyshev Date: Mon, 12 May 2014 01:44:14 +0000 (-0700) Subject: Fix bug #67249: printf out-of-bounds read X-Git-Tag: php-5.4.30RC1~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=091b7642c2d8a087d3cbcba681369abfb964330d;p=php Fix bug #67249: printf out-of-bounds read --- diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 3cd5839313..2592b1655d 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -376,6 +376,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC int alignment, currarg, adjusting, argnum, width, precision; char *format, *result, padding; int always_sign; + int format_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { return NULL; @@ -414,11 +415,12 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC convert_to_string_ex(args[format_offset]); format = Z_STRVAL_PP(args[format_offset]); + format_len = Z_STRLEN_PP(args[format_offset]); result = emalloc(size); currarg = 1; - while (inpos +--EXPECT-- +string(0) ""