summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2011-08-10 17:40:56 +0000
committerRasmus Lerdorf <rasmus@php.net>2011-08-10 17:40:56 +0000
commitde90c602e1f23637a65a5dd79f5b4fc5db848a3d (patch)
treed70534f5b6d82adf86f000b8c1052da8c02cdcd3
parent9fd373d8b66f2ac8a52bda6d43e3cbc875f317d5 (diff)
downloadphp-git-de90c602e1f23637a65a5dd79f5b4fc5db848a3d.tar.gz
Use HOST_NAME_MAX constant here instead for the gethostname() func
-rw-r--r--ext/standard/dns.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 4ad26bb6e2..9cd12ce0f9 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;