From: Rasmus Lerdorf Date: Wed, 10 Aug 2011 17:40:56 +0000 (+0000) Subject: Use HOST_NAME_MAX constant here instead for the gethostname() func X-Git-Tag: php-5.4.0beta1~445 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14948624af062ceea823fd6c6c274783cbec08c6;p=php Use HOST_NAME_MAX constant here instead for the gethostname() func --- diff --git a/ext/standard/dns.c b/ext/standard/dns.c index d0979a32f9..8906bd8007 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -66,6 +66,12 @@ #define MAXHOSTNAMELEN 255 #endif +/* For the local hostname obtained via gethostname which is different from the + dns-related MAXHOSTNAMELEN constant above */ +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + #include "php_dns.h" /* type compat */ @@ -122,7 +128,7 @@ static char *php_gethostbyname(char *name); Get the host name of the current machine */ PHP_FUNCTION(gethostname) { - char buf[MAXHOSTNAMELEN]; + char buf[HOST_NAME_MAX]; if (zend_parse_parameters_none() == FAILURE) { return;