From 75f721f4a0c13c333b803e3ff1d7a25f0ed0d3cf Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 21 Sep 2011 16:00:09 +0000 Subject: [PATCH] Fixed bug #55755 (SegFault when outputting header WWW-Authenticate) --- sapi/cli/php_cli_server.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index facb0b615a..ec3b9ddb17 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1583,6 +1583,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli request_info->query_string = client->request.query_string; request_info->post_data = client->request.content; request_info->content_length = request_info->post_data_length = client->request.content_len; + request_info->auth_user = request_info->auth_password = request_info->auth_digest = NULL; if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", sizeof("Content-Type"), (void**)&val)) { request_info->content_type = *val; } @@ -1764,9 +1765,9 @@ static int php_cli_server_dispatch_script(php_cli_server *server, php_cli_server { php_cli_server_client_populate_request_info(client, &SG(request_info)); { - zval **val; - if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&val)) { - php_handle_auth_data(Z_STRVAL_PP(val) TSRMLS_CC); + char **auth; + if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&auth)) { + php_handle_auth_data(*auth TSRMLS_CC); } } SG(sapi_headers).http_response_code = 200; @@ -1867,9 +1868,9 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server php_cli_server_client_populate_request_info(client, &SG(request_info)); { - zval **val; - if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&val)) { - php_handle_auth_data(Z_STRVAL_PP(val) TSRMLS_CC); + char **auth; + if (SUCCESS == zend_hash_find(&client->request.headers, "Authorization", sizeof("Authorization"), (void**)&auth)) { + php_handle_auth_data(*auth TSRMLS_CC); } } SG(sapi_headers).http_response_code = 200; -- 2.40.0