summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli_server.c
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2016-02-29 19:31:20 +0000
committerJakub Zelenka <bukka@php.net>2016-02-29 19:31:20 +0000
commit70141093a731049ee9220e9e965f61ded56ed4d5 (patch)
tree6e67b382253a186889bfdc37c31062d6fb9880d9 /sapi/cli/php_cli_server.c
parente453af3851daf08f5af9b45fc7819c3a9c336f1e (diff)
parent97294aca7e066443291cc2d77f8674ac23eabb32 (diff)
downloadphp-git-70141093a731049ee9220e9e965f61ded56ed4d5.tar.gz
Merge branch 'master' into openssl_aead
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r--sapi/cli/php_cli_server.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 4ee85bf538..ac41c44def 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1955,6 +1955,19 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv
return php_cli_server_send_error_page(server, client, 400);
}
+#ifdef PHP_WIN32
+ /* The win32 namespace will cut off trailing dots and spaces. Since the
+ VCWD functionality isn't used here, a sophisticated functionality
+ would have to be reimplemented to know ahead there are no files
+ with invalid names there. The simplest is just to forbid invalid
+ filenames, which is done here. */
+ if (client->request.path_translated &&
+ ('.' == client->request.path_translated[client->request.path_translated_len-1] ||
+ ' ' == client->request.path_translated[client->request.path_translated_len-1])) {
+ return php_cli_server_send_error_page(server, client, 500);
+ }
+#endif
+
fd = client->request.path_translated ? open(client->request.path_translated, O_RDONLY): -1;
if (fd < 0) {
return php_cli_server_send_error_page(server, client, 404);