]> granicus.if.org Git - php/commitdiff
Fixed bug #55755 (SegFault when outputting header WWW-Authenticate)
authorXinchen Hui <laruence@php.net>
Wed, 21 Sep 2011 16:00:09 +0000 (16:00 +0000)
committerXinchen Hui <laruence@php.net>
Wed, 21 Sep 2011 16:00:09 +0000 (16:00 +0000)
sapi/cli/php_cli_server.c

index facb0b615ac2b369033761bc38f0e617d16cfc9f..ec3b9ddb174e2d99a3c3476c0a00ce9b8b10266e 100644 (file)
@@ -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;