Date: Fri, 20 Dec 2002 20:02:46 +0900 (JST) From: endou <endou@fks.ed.jp> To: FreeBSD-gnats-submit@FreeBSD.org Cc: endou@fks.ed.jp Subject: bin/46395: usr/sbin/newsyslog -v daytime incorrect Message-ID: <200212201103.gBKB2kcl060166@kaede.ut.fks.ed.jp>
index | next in thread | raw e-mail
>Number: 46395
>Category: bin
>Synopsis: usr.sbin/newsyslog -v daytime incorrect
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Dec 20 03:10:01 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212201103.gBKB2kcl060166>
