diff options
author | Anatol Belski <ab@php.net> | 2017-11-28 12:43:03 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-11-28 12:43:03 +0100 |
commit | af55904f18909e9c7e6898c61ed2a5a327b7e4c4 (patch) | |
tree | 815e31f32333762ab9c4a9d701f95aab8b120c07 /sapi/cli/php_cli_server.c | |
parent | 6a2738c713293f9e0dfa19feab296a8da902cb50 (diff) | |
parent | 79940993ded3328459aae3797f96973dc4f13a71 (diff) | |
download | php-git-af55904f18909e9c7e6898c61ed2a5a327b7e4c4.tar.gz |
Merge branch 'PHP-7.2'
* PHP-7.2:
Fixed bug #73830 Directory does not exist.
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r-- | sapi/cli/php_cli_server.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 15b79864e9..dd4faa3036 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2522,6 +2522,10 @@ int do_cli_server(int argc, char **argv) /* {{{ */ const char *server_bind_address = NULL; extern const opt_struct OPTIONS[]; const char *document_root = NULL; +#ifdef PHP_WIN32 + char document_root_tmp[MAXPATHLEN]; + size_t k; +#endif const char *router = NULL; char document_root_buf[MAXPATHLEN]; @@ -2531,7 +2535,23 @@ int do_cli_server(int argc, char **argv) /* {{{ */ server_bind_address = php_optarg; break; case 't': +#ifndef PHP_WIN32 document_root = php_optarg; +#else + k = strlen(php_optarg); + if (k + 1 > MAXPATHLEN) { + fprintf(stderr, "Document root path is too long.\n"); + return 1; + } + memmove(document_root_tmp, php_optarg, k + 1); + /* Clean out any trailing garbage that might have been passed + from a batch script. */ + do { + document_root_tmp[k] = '\0'; + k--; + } while ('"' == document_root_tmp[k] || ' ' == document_root_tmp[k]); + document_root = document_root_tmp; +#endif break; } } |