Fix crash with a dotless hostname.

This commit is contained in:
glebius 2017-12-06 17:50:10 +00:00
parent f247f2d5c2
commit d03569547d

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 */