Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 1999 16:25:48 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/9506: cron(8) is not Y2K compliant
Message-ID:  <99Jan15.162511est.40330@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help

>Number:         9506
>Category:       bin
>Synopsis:       cron(8) is not Y2K compliant
>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:   Thu Jan 14 21:30:03 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Peter Jeremy
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
Alcatel Australia
>Environment:

	

>Description:

cron(8) uses a raw tm_year and will therefore display 100 for 2000.
Use snprintf to protect against excessively long timezone names.

>How-To-Repeat:

Code inspection

>Fix:
	
--- /3.0/src/usr.sbin/cron/lib/misc.c	Mon Sep 15 16:39:25 1997
+++ ./misc.c	Fri Jan 15 14:48:23 1999
@@ -619,9 +619,12 @@
 {
 	time_t t = clock ?*clock :time(0L);
 	struct tm *tm = localtime(&t);
-	static char ret[30];	/* zone name might be >3 chars */
+	static char ret[32];	/* zone name might be >3 chars */
 
-	(void) sprintf(ret, "%s, %2d %s %2d %02d:%02d:%02d %s",
+	if (tm->tm_year >= 100)
+		tm->tm_year += 1900;
+
+	(void) snprintf(ret, sizeof(ret), "%s, %2d %s %2d %02d:%02d:%02d %s",
 		       DowNames[tm->tm_wday],
 		       tm->tm_mday,
 		       MonthNames[tm->tm_mon],
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99Jan15.162511est.40330>