From c8aa42a2da4c939e05d864d85cb3530a6e67f68f Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 14 May 2016 04:29:13 +0000 Subject: [PATCH] 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 --- usr.sbin/timed/timed/timed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c index 21c98b0c3b5..a8efd6dbe66 100644 --- a/usr.sbin/timed/timed/timed.c +++ b/usr.sbin/timed/timed/timed.c @@ -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;