php-src/main
Sara Golemon bab0b99f37 Detect invalid port in xp_socket parse ip address
For historical reasons, fsockopen() accepts the port and hostname
separately: fsockopen('127.0.0.1', 80)

However, with the introdcution of stream transports in PHP 4.3,
it became possible to include the port in the hostname specifier:

fsockopen('127.0.0.1:80')
Or more formally: fsockopen('tcp://127.0.0.1:80')

Confusing results when these two forms are combined, however.
fsockopen('127.0.0.1:80', 443) results in fsockopen() attempting
to connect to '127.0.0.1:80:443' which any reasonable stack would
consider invalid.

Unfortunately, PHP parses the address looking for the first colon
(with special handling for IPv6, don't worry) and calls atoi()
from there.  atoi() in turn, simply stops parsing at the first
non-numeric character and returns the value so far.

The end result is that the explicitly supplied port is treated
as ignored garbage, rather than producing an error.

This diff replaces atoi() with strtol() and inspects the
stop character.  If additional "garbage" of any kind is found,
it fails and returns an error.
2017-03-07 12:10:53 -08:00
..
streams Detect invalid port in xp_socket parse ip address 2017-03-07 12:10:53 -08:00
alloca.c
build-defs.h.in Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
fastcgi.c Fixed bug #69860 2017-02-12 00:06:04 +01:00
fastcgi.h Fixed bug #69860 2017-02-12 00:06:04 +01:00
fopen_wrappers.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
fopen_wrappers.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
getopt.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
http_status_codes.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
internal_functions_nw.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
internal_functions_win32.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
internal_functions.c.in Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
main.c updated default per proposal 2017-01-06 05:25:08 +00:00
mergesort.c first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
network.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
output.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_compat.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_content_types.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_content_types.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_getopt.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_globals.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_ini.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_ini.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_main.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_memory_streams.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_network.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_open_temporary_file.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_open_temporary_file.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_output.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_reentrancy.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_scandir.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_scandir.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_sprintf.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_stdint.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_streams.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_syslog.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_ticks.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_ticks.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_variables.c Improve fix for bug #73807 2017-02-25 12:55:14 +01:00
php_variables.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
php_version.h prepare next 2017-02-28 09:46:11 +01:00
php.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
reentrancy.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
rfc1867.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
rfc1867.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
SAPI.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
SAPI.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
snprintf.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
snprintf.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
spprintf.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
spprintf.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
strlcat.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
strlcpy.c Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
win95nt.h Update copyright headers to 2017 2017-01-04 11:14:55 -06:00