]> granicus.if.org Git - php/commitdiff
Use HOST_NAME_MAX constant here instead for the gethostname() func
authorRasmus Lerdorf <rasmus@php.net>
Wed, 10 Aug 2011 17:40:56 +0000 (17:40 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Wed, 10 Aug 2011 17:40:56 +0000 (17:40 +0000)
ext/standard/dns.c

index 4ad26bb6e2a955fe1b08ca325d34c5d0a1104e04..9cd12ce0f9dc53d367d49ed15462492bd7988933 100644 (file)
 #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;