diff options
author | nil0x42 <nil0x42@users.noreply.github.com> | 2014-07-11 19:48:03 +0200 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2014-11-30 22:29:24 -0800 |
commit | a87300241fc065c0020c7caf7a0e2e9b57405ad0 (patch) | |
tree | 89f5b86788425e99c3244b0a557d5387be4257a9 /sapi/cli/php_cli_server.c | |
parent | f75da60b18f12fb986179caf59523921e9f49bbc (diff) | |
download | php-git-a87300241fc065c0020c7caf7a0e2e9b57405ad0.tar.gz |
Fix php cli (-S option) inconsistent port parsing
Add port range verification of listening port with -S option for the php cli.
This fixes inconsistent listening port due to unverified cast from long to short
with htons(3).
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r-- | sapi/cli/php_cli_server.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 6cefa2de9f..5e38fa53d3 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2257,7 +2257,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 +2273,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; } } |