From endou@fks.ed.jp  Fri Dec 20 03:04:35 2002
Return-Path: <endou@fks.ed.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2F33A37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 03:04:35 -0800 (PST)
Received: from kisaragi.fks.ed.jp (kisaragi.fks.ed.jp [210.239.12.130])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E34A043EDA
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 03:04:33 -0800 (PST)
	(envelope-from endou@fks.ed.jp)
Received: from top1.fks.ed.jp (TAOPrivate-D-top1ad.fks.ed.jp [210.239.18.9])
	by kisaragi.fks.ed.jp (8.12.5/8.12.5) with ESMTP id gBKB4KB6043261
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 20:04:20 +0900 (JST)
	(envelope-from endou@fks.ed.jp)
Received: from tetsu.ad.fks.ed.jp (tetsu.ad.fks.ed.jp [10.184.254.210])
	by top1.fks.ed.jp (8.12.6/8.12.3/8.12.5) with ESMTP id gBKB4KGH002158
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 20:04:20 +0900 (JST)
Received: from top1.fks.ed.jp (localhost [127.0.0.1])
	by tetsu.ad.fks.ed.jp (8.12.6/8.12.6/Submit) with ESMTP id gBKB4JNV016981
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 20:04:20 +0900 (JST)
Received: from kaede.ut.fks.ed.jp (kaede.ut.fks.ed.jp [192.168.3.6])
	by top1.fks.ed.jp (8.12.6/8.12.3/8.12.5) with ESMTP id gBKB4JGH002155
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 20:04:19 +0900 (JST)
Received: from fks.ed.jp (ebine.ut.fks.ed.jp [192.168.3.4])
	by kaede.ut.fks.ed.jp (8.12.6/8.11.5/8.11.5) with SMTP id gBKB2kcl060166
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 20 Dec 2002 20:03:34 +0900 (JST)
	(envelope-from endou@fks.ed.jp)
Message-Id: <200212201103.gBKB2kcl060166@kaede.ut.fks.ed.jp>
Date: Fri, 20 Dec 2002 20:02:46 +0900 (JST)
From: endou <endou@fks.ed.jp>
Reply-To: endou <endou@fks.ed.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc: endou@fks.ed.jp
Subject: usr/sbin/newsyslog -v daytime incorrect
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         46395
>Category:       bin
>Synopsis:       usr.sbin/newsyslog -v daytime incorrect
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 20 03:10:01 PST 2002
>Closed-Date:    Tue Dec 24 10:28:19 PST 2002
>Last-Modified:  Tue Dec 24 10:28:19 PST 2002
>Originator:     endou
>Release:        FreeBSD 4.7-RELEASE-p2 i386
>Organization:
FKS.ED.JP
>Environment:
System: FreeBSD ebine.ut.fks.ed.jp 4.7-RELEASE-p2 FreeBSD 4.7-RELEASE-p2 #1: Fri Nov 15 12:33:32 JST 2002 moto@ebine.ut.fks.ed.jp:/usr/obj/usr/src/sys/FKS i386
>Description:
        date presentation of line that the logs were turned over is incorrect
        over write by ctime(&ent->trim_at)
>How-To-Repeat:
        newsyslog -v 
>Fix:

         patch for /usr/src/usr.sbin/newsyslog/newsyslog.c

--- newsyslog.c.org	Fri Dec 20 19:31:48 2002
+++ newsyslog.c	Fri Dec 20 19:32:54 2002
@@ -98,7 +98,7 @@
 #define MIN_PID         5
 #define MAX_PID		99999	/* was lower, see /usr/include/sys/proc.h */
 char hostname[MAXHOSTNAMELEN];	/* hostname */
-char *daytime;			/* timenow in human readable form */
+char daytime[26];		/* timenow in human readable form */
 
 static struct conf_entry *parse_file(char **files);
 static char *sob(char *p);
@@ -220,8 +220,7 @@
 	char *p;
 
 	timenow = time((time_t *) 0);
-	daytime = ctime(&timenow) + 4;
-	daytime[15] = '\0';
+	(void)strncpy(daytime, ctime(&timenow) + 4, 15);
 
 	/* Let's get our hostname */
 	(void) gethostname(hostname, sizeof(hostname));



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: trhodes 
State-Changed-When: Sat Dec 21 14:28:31 PST 2002 
State-Changed-Why:  
Different version of the patch committed.  I'll MFC soon, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46395 
State-Changed-From-To: patched->closed 
State-Changed-By: trhodes 
State-Changed-When: Tue Dec 24 10:27:40 PST 2002 
State-Changed-Why:  
Merged with 5.0RELEASE, thanks for the submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46395 
>Unformatted:
