fat Mon, 18 Jul 2011 21:03:44 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313405
Log:
fix a segfault when passing an empty value to a ini parameter from the web
server (php_(admin_)?value)
Changed paths:
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c
U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-07-18
21:00:59 UTC (rev 313404)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-07-18
21:03:44 UTC (rev 313405)
@@ -1430,22 +1430,28 @@
static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int
callback_type, void *arg TSRMLS_DC) /* {{{ */
{
int *mode = (int *)arg;
- char *key = Z_STRVAL_P(arg1);
- char *value = Z_STRVAL_P(arg2);
+ char *key;
+ char *value = NULL;
struct key_value_s kv;
- if (!mode) return;
+ if (!mode || !arg1) return;
if (callback_type != ZEND_INI_PARSER_ENTRY) {
fprintf(stderr, "Passing INI directive through FastCGI: only
classic entries are allowed\n");
return;
}
+ key = Z_STRVAL_P(arg1);
+
if (!key || strlen(key) < 1) {
fprintf(stderr, "Passing INI directive through FastCGI: empty
key\n");
return;
}
+ if (arg2) {
+ value = Z_STRVAL_P(arg2);
+ }
+
if (!value) {
fprintf(stderr, "Passing INI directive through FastCGI: empty
value for key '%s'\n", key);
return;
Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c 2011-07-18
21:00:59 UTC (rev 313404)
+++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c 2011-07-18
21:03:44 UTC (rev 313405)
@@ -1327,22 +1327,28 @@
static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int
callback_type, void *arg TSRMLS_DC) /* {{{ */
{
int *mode = (int *)arg;
- char *key = Z_STRVAL_P(arg1);
- char *value = Z_STRVAL_P(arg2);
+ char *key;
+ char *value = NULL;
struct key_value_s kv;
- if (!mode) return;
+ if (!mode || !arg1) return;
if (callback_type != ZEND_INI_PARSER_ENTRY) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: only
classic entries are allowed");
return;
}
+ key = Z_STRVAL_P(arg1);
+
if (!key || strlen(key) < 1) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty
key");
return;
}
+ if (arg2) {
+ value = Z_STRVAL_P(arg2);
+ }
+
if (!value) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty
value for key '%s'", key);
return;
Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-07-18 21:00:59 UTC (rev
313404)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-07-18 21:03:44 UTC (rev
313405)
@@ -1327,22 +1327,28 @@
static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int
callback_type, void *arg TSRMLS_DC) /* {{{ */
{
int *mode = (int *)arg;
- char *key = Z_STRVAL_P(arg1);
- char *value = Z_STRVAL_P(arg2);
+ char *key;
+ char *value = NULL;
struct key_value_s kv;
- if (!mode) return;
+ if (!mode || !arg1) return;
if (callback_type != ZEND_INI_PARSER_ENTRY) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: only
classic entries are allowed");
return;
}
+ key = Z_STRVAL_P(arg1);
+
if (!key || strlen(key) < 1) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty
key");
return;
}
+ if (arg2) {
+ value = Z_STRVAL_P(arg2);
+ }
+
if (!value) {
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty
value for key '%s'", key);
return;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php