Subject: bin/34055: wierd output from date
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <new.security@gmail.com>
List: netbsd-bugs
Date: 07/22/2006 21:10:00
>Number: 34055
>Category: bin
>Synopsis: wierd output from date
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jul 22 21:10:00 +0000 2006
>Originator: Kevin Massey
>Release:
>Organization:
>Environment:
>Description:
when using a large string on the + option for date it prints strange characters at the end of the date string.
>How-To-Repeat:
date +`perl -e 'print "A" x 9999'`
>Fix:
Index: date.c
===================================================================
RCS file: /cvsroot/src/bin/date/date.c,v
retrieving revision 1.42
diff -u -r1.42 date.c
--- date.c 22 Jul 2005 14:27:08 -0000 1.42
+++ date.c 22 Jul 2006 20:51:41 -0000
@@ -123,7 +123,7 @@
if (*argv && **argv == '+')
format = *argv + 1;
- (void)strftime(buf, sizeof(buf), format, localtime(&tval));
+ (void)strftime(buf, sizeof(buf)-93, format, localtime(&tval));
(void)printf("%s\n", buf);
exit(retval);
/* NOTREACHED */