diff options
author | Ondřej Surý <ondrej@sury.org> | 2015-02-20 10:01:00 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2015-02-20 10:01:00 +0100 |
commit | 347aa01617585e89149414a9763175a19d2dc651 (patch) | |
tree | 98170e6aeca907f029fe7b5abbbd2e7f2f4a5412 /main/network.c | |
parent | 832b62efb8fceebb220116d8024d945a9bd31d7e (diff) | |
download | php-upstream.tar.gz |
New upstream version 5.6.6+dfsgupstream
Diffstat (limited to 'main/network.c')
-rw-r--r-- | main/network.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/network.c b/main/network.c index f8336442d..636afc62b 100644 --- a/main/network.c +++ b/main/network.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2014 The PHP Group | + | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -24,7 +24,7 @@ #include "php.h" #include <stddef.h> - +#include <errno.h> #ifdef PHP_WIN32 @@ -246,7 +246,12 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka #else if (!inet_aton(host, &in)) { /* XXX NOT THREAD SAFE (is safe under win32) */ - host_info = gethostbyname(host); + if(strlen(host) > MAXFQDNLEN) { + host_info = NULL; + errno = E2BIG; + } else { + host_info = gethostbyname(host); + } if (host_info == NULL) { if (error_string) { spprintf(error_string, 0, "php_network_getaddresses: gethostbyname failed. errno=%d", errno); |