Skip to content

Commit 158b06c

Browse files
Merge branch 'PHP-7.0' into PHP-7.1
2 parents 11d3a78 + 61538eb commit 158b06c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ PHP NEWS
88
- CURL:
99
. Fixed bug #75093 (OpenSSL support not detected). (Remi)
1010

11+
- Standard:
12+
. Fixed bug #75097 (gethostname fails if your host name is 64 chars long). (Andrea)
1113

1214
31 Aug 2017, PHP 7.1.9
1315

ext/standard/dns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ static zend_string *php_gethostbyname(char *name);
131131
Get the host name of the current machine */
132132
PHP_FUNCTION(gethostname)
133133
{
134-
char buf[HOST_NAME_MAX];
134+
char buf[HOST_NAME_MAX + 1];
135135

136136
if (zend_parse_parameters_none() == FAILURE) {
137137
return;
138138
}
139139

140-
if (gethostname(buf, sizeof(buf) - 1)) {
140+
if (gethostname(buf, sizeof(buf))) {
141141
php_error_docref(NULL, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno));
142142
RETURN_FALSE;
143143
}

0 commit comments

Comments
 (0)