Skip to content

Commit 251879c

Browse files
author
Jérôme Loyet
committed
fix a segfault when passing an empty value to a ini parameter from the web server (php_(admin_)?value)
1 parent 3c323a5 commit 251879c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sapi/fpm/fpm/fpm_main.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -1327,22 +1327,28 @@ static void init_request_info(TSRMLS_D)
13271327
static void fastcgi_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback_type, void *arg TSRMLS_DC) /* {{{ */
13281328
{
13291329
int *mode = (int *)arg;
1330-
char *key = Z_STRVAL_P(arg1);
1331-
char *value = Z_STRVAL_P(arg2);
1330+
char *key;
1331+
char *value = NULL;
13321332
struct key_value_s kv;
13331333

1334-
if (!mode) return;
1334+
if (!mode || !arg1) return;
13351335

13361336
if (callback_type != ZEND_INI_PARSER_ENTRY) {
13371337
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: only classic entries are allowed");
13381338
return;
13391339
}
13401340

1341+
key = Z_STRVAL_P(arg1);
1342+
13411343
if (!key || strlen(key) < 1) {
13421344
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty key");
13431345
return;
13441346
}
13451347

1348+
if (arg2) {
1349+
value = Z_STRVAL_P(arg2);
1350+
}
1351+
13461352
if (!value) {
13471353
zlog(ZLOG_ERROR, "Passing INI directive through FastCGI: empty value for key '%s'", key);
13481354
return;

0 commit comments

Comments
 (0)