Fix crash with a dotless hostname.

This commit is contained in:
Gleb Smirnoff 2017-12-06 17:50:10 +00:00
parent 99ae1d3b25
commit 2ff3551a47

View File

@ -183,7 +183,7 @@ main(int argc, char *argv[])
if (hostname == NULL) {
hostname = hbuf;
(void )gethostname(hbuf, MAXHOSTNAMELEN);
*strchr(hostname, '.') = '\0';
*strchrnul(hostname, '.') = '\0';
}
/* log input line if appropriate */