svn commit: r326625 - head/usr.bin/logger

Gleb Smirnoff glebius at FreeBSD.org
Wed Dec 6 17:50:12 UTC 2017


Author: glebius
Date: Wed Dec  6 17:50:10 2017
New Revision: 326625
URL: https://svnweb.freebsd.org/changeset/base/326625

Log:
  Fix crash with a dotless hostname.

Modified:
  head/usr.bin/logger/logger.c

Modified: head/usr.bin/logger/logger.c
==============================================================================
--- head/usr.bin/logger/logger.c	Wed Dec  6 17:01:25 2017	(r326624)
+++ head/usr.bin/logger/logger.c	Wed Dec  6 17:50:10 2017	(r326625)
@@ -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 */


More information about the svn-src-head mailing list