diff options
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r-- | sapi/cli/php_cli_server.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 6cefa2de9f..3b5fe05945 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2014 The PHP Group | + | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -708,6 +708,11 @@ static void sapi_cli_server_register_variable(zval *track_vars_array, const char { char *new_val = (char *)val; uint new_val_len; + + if (NULL == val) { + return; + } + if (sapi_module.input_filter(PARSE_SERVER, (char*)key, &new_val, strlen(val), &new_val_len TSRMLS_CC)) { php_register_variable_safe((char *)key, new_val, new_val_len, track_vars_array TSRMLS_CC); } @@ -1848,8 +1853,7 @@ static void php_cli_server_client_populate_request_info(const php_cli_server_cli request_info->request_uri = client->request.request_uri; request_info->path_translated = client->request.path_translated; 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->content_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; @@ -2257,7 +2261,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c *p++ = '\0'; if (*p == ':') { port = strtol(p + 1, &p, 10); - if (port <= 0) { + if (port <= 0 || port > 65535) { p = NULL; } } else if (*p != '\0') { @@ -2273,7 +2277,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c if (p) { *p++ = '\0'; port = strtol(p, &p, 10); - if (port <= 0) { + if (port <= 0 || port > 65535) { p = NULL; } } @@ -2342,7 +2346,7 @@ out: if (_router) { pefree(_router, 1); } - if (server_sock >= -1) { + if (server_sock > -1) { closesocket(server_sock); } } |