Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 May 2016 04:29:13 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299713 - head/usr.sbin/timed/timed
Message-ID:  <201605140429.u4E4TDSj036951@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sat May 14 04:29:13 2016
New Revision: 299713
URL: https://svnweb.freebsd.org/changeset/base/299713

Log:
  Undo the bogus gethostname() change from r299709.
  
  The "- 1" is there specifically to enable checking for NUL termination.
  
  I should also admit the rest change was mostly cosmetic and the
  overruns can't occur in practice: still I leave them to pacify
  static analyzers.
  
  Pointed out by:	bde

Modified:
  head/usr.sbin/timed/timed/timed.c

Modified: head/usr.sbin/timed/timed/timed.c
==============================================================================
--- head/usr.sbin/timed/timed/timed.c	Sat May 14 04:13:28 2016	(r299712)
+++ head/usr.sbin/timed/timed/timed.c	Sat May 14 04:29:13 2016	(r299713)
@@ -196,7 +196,7 @@ main(int argc, char *argv[])
 	if (goodgroup != NULL || goodhosts != NULL)
 		Mflag = 1;
 
-	if (gethostname(hostname, sizeof(hostname)) < 0)
+	if (gethostname(hostname, sizeof(hostname) - 1) < 0)
 		err(1, "gethostname");
 	self.l_bak = &self;
 	self.l_fwd = &self;



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