Patch 5.4-fix for Built-in web server Bug #55107
Patch version 2011-07-19 17:29 UTC
Return to Bug #55107 |
Download this patch
Patch Revisions:
Developer: fa@php.net
--- sapi/cli/php_cli_server.c.orig 2011-07-19 19:25:07.000000000 +0200
+++ sapi/cli/php_cli_server.c 2011-07-19 19:24:54.000000000 +0200
@@ -242,8 +242,9 @@
};
static php_cli_server_http_reponse_status_code_pair template_map[] = {
+ { 400, "<h1 class=\"h\">%s</h1><p>Bad Request.</p>" },
{ 404, "<h1 class=\"h\">%s</h1><p>The requested resource %s was not found on this server.</p>" },
- { 500, "<h1 class=\"h\">%s</h1><p>The server is temporality unavaiable.</p>" }
+ { 500, "<h1 class=\"h\">%s</h1><p>The server is temporarily unavailable.</p>" }
};
static php_cli_server_ext_mime_type_pair mime_type_map[] = {
@@ -1735,6 +1736,14 @@
SG(server_context) = client;
status = php_cli_server_dispatch_router(server, client TSRMLS_CC);
+ /* check for null bytes in the url, bug #55107 */
+ if (strlen(client->request.vpath) != client->request.vpath_len) {
+ if (SUCCESS != php_cli_server_send_error_page(server, client, 400 TSRMLS_CC)) {
+ goto fail;
+ }
+ SG(server_context) = 0;
+ return SUCCESS;
+ }
if (status < 0) {
goto fail;
} else if (status > 0) {
|