Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Dec 2017 17:50:10 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326625 - head/usr.bin/logger
Message-ID:  <201712061750.vB6HoAA8030308@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712061750.vB6HoAA8030308>