com php-src: Fixed bug #71559 Built-in HTTP server, we can downlaod file in web by bug: sapi/cli/php_cli_server.c
| From: | Anatol Belski | Date: | Sun, 14 Feb 2016 19:47:23 +0000 |
| Subject: | com php-src: Fixed bug #71559 Built-in HTTP server, we can downlaod file in web by bug: sapi/cli/php_cli_server.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91018@lists.php.net to get a copy of this message | ||
Commit: ce4a2f0fc60309f429e4c04160a71befc283338a
Author: Anatol Belski <ab@php.net> Sun, 14 Feb 2016 20:47:23 +0100
Parents: fece24f8f4750d4fb75b89f8b9bd69046edeb5a9
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ce4a2f0fc60309f429e4c04160a71befc283338a
Log:
Fixed bug #71559 Built-in HTTP server, we can downlaod file in web by bug
Bugs:
https://bugs.php.net/71559
Changed paths:
M sapi/cli/php_cli_server.c
Diff:
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index f85d126..169c05b 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -2058,6 +2058,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 TSRMLS_CC);
}
+#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 TSRMLS_CC);