Skip to content

Commit 80d17cb

Browse files
Merge branch 'PHP-7.2'
2 parents e33259f + ccb09d2 commit 80d17cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/dns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ static zend_string *php_gethostbyname(char *name);
126126
Get the host name of the current machine */
127127
PHP_FUNCTION(gethostname)
128128
{
129-
char buf[HOST_NAME_MAX];
129+
char buf[HOST_NAME_MAX + 1];
130130

131131
if (zend_parse_parameters_none() == FAILURE) {
132132
return;
133133
}
134134

135-
if (gethostname(buf, sizeof(buf) - 1)) {
135+
if (gethostname(buf, sizeof(buf))) {
136136
php_error_docref(NULL, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno));
137137
RETURN_FALSE;
138138
}

0 commit comments

Comments
 (0)