Subject: lib/6517: strftime %s returns non-terminaterd string
To: None <gnats-bugs@gnats.netbsd.org>
From: Tatoku Ogaito <tacha@tera.fukui-med.ac.jp>
List: netbsd-bugs
Date: 12/01/1998 13:35:43
>Number:         6517
>Category:       lib
>Synopsis:       strftime %s returns non-terminaterd string
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 30 20:50:00 1998
>Last-Modified:
>Originator:     Tatoku Ogaito
>Organization:
-----            : Tatoku Ogaito
   / _  _ _/ _   : Department of Physics, Fukui Medical University
  / (_|(_ /)(_|  : E-mail: tacha@tera.fukui-med.ac.jp
>Release:        current as of 1998/11/29
>Environment:
	
System: NetBSD tera.fukui-med.ac.jp 1.3I NetBSD 1.3I (TERA) #130: Mon Nov 30 20:56:58 JST 1998 root@tera.fukui-med.ac.jp:/usr/current/src/sys/arch/i386/compile/TERA i386


>Description:
	Invoke strftime with format string %s, 
it returns non-terminated string. 
>How-To-Repeat:
	date +%s
>Fix:
*** strftime.c~	Mon Nov 16 08:28:10 1998
--- strftime.c	Tue Dec  1 13:23:58 1998
***************
*** 315,320 ****
--- 315,321 ----
  	char *p;
  	struct tm tmp;
  
+ 	buf[sizeof (buf) - 1] = '\0';
  	/* Make a copy, mktime(3) modifies the tm struct. */
  	tmp = *t;
  	s = mktime(&tmp);

>Audit-Trail:
>Unformatted: