pajoye Mon, 26 Sep 2011 08:36:33 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=317304
Log: - Fix bug #55622, better fix for this issue, old fix can break if sizeof(size_t) > sizeof(int) like on sparc Bug: https://bugs.php.net/55622 (error getting bug information) Changed paths: U php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c U php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26 08:24:46 UTC (rev 317303) +++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26 08:36:33 UTC (rev 317304) @@ -6022,7 +6022,7 @@ PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; - size_t str_len = 0; + int str_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; @@ -6031,6 +6031,10 @@ RETURN_FALSE; } + if (INT_MAX - str_len < ZEND_MMAP_AHEAD) { + RETVAL_FALSE; + } + /* Set callback function */ if (process_sections) { BG(active_ini_file_section) = NULL; Modified: php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-09-26 08:24:46 UTC (rev 317303) +++ php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-09-26 08:36:33 UTC (rev 317304) @@ -3989,7 +3989,13 @@ ptr = emalloc(size); size = GetEnvironmentVariableA(str, ptr, size); - RETURN_STRING(ptr, 0); + if (size == 0) { + /* has been removed between the two calls */ + efree(ptr); + RETURN_EMPTY_STRING(); + } else { + RETURN_STRING(ptr, 0); + } } #else /* system method returns a const */ @@ -5930,7 +5936,7 @@ PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; - size_t str_len = 0; + int str_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; @@ -5939,6 +5945,10 @@ RETURN_FALSE; } + if (INT_MAX - str_len < ZEND_MMAP_AHEAD) { + RETVAL_FALSE; + } + /* Set callback function */ if (process_sections) { BG(active_ini_file_section) = NULL;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php