]> granicus.if.org Git - php/commitdiff
fix a segfault when passing an empty value to a ini parameter from the web server...
authorJérôme Loyet <fat@php.net>
Mon, 18 Jul 2011 21:03:44 +0000 (21:03 +0000)
committerJérôme Loyet <fat@php.net>
Mon, 18 Jul 2011 21:03:44 +0000 (21:03 +0000)
sapi/fpm/fpm/fpm_main.c

index f362a2cbc3f5d0b1d0a313de869317dfcc97bc5d..cda0c1d983b25dc85d3e93ddd2a15f88b68ed6cf 100644 (file)
@@ -1327,22 +1327,28 @@ static void init_request_info(TSRMLS_D)
 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;