[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#291572: marked as done (libc: strptime fails to check legal value range for seconds)



Your message dated Sun, 23 Jan 2005 01:32:56 +0900
with message-id <81llalpgp3.wl@omega.webmasters.gr.jp>
and subject line Bug#291572: libc: strptime fails to check legal value range for seconds
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 21 Jan 2005 16:15:49 +0000
>From tfinneid@ifi.uio.no Fri Jan 21 08:15:49 2005
Return-path: <tfinneid@ifi.uio.no>
Received: from sedna.sxdesign.com [193.71.196.11] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1Cs1Rt-0006LS-00; Fri, 21 Jan 2005 08:15:49 -0800
Received: from [80.203.147.2] (helo=pluto)
	by sedna.sxdesign.com with asmtp (Exim 4.34)
	id 1Cs1Rp-0003j6-Dc
	for submit@bugs.debian.org; Fri, 21 Jan 2005 17:15:45 +0100
Subject: libc: strptime fails to check legal value range for seconds
From: Thomas Finneid <tfinneid@ifi.uio.no>
To: submit@bugs.debian.org
Content-Type: text/plain
Date: Fri, 21 Jan 2005 17:15:45 +0100
Message-Id: <[🔎] 1106324145.15233.182.camel@pluto>
Mime-Version: 1.0
X-Mailer: Evolution 2.0.3 
Content-Transfer-Encoding: 7bit
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

Package: libc6
Version: 2.3.2.ds1-20

The following format specifier fails to validate the seconds argument
valid value ranges, 0-59. All other values are validated as legal.

    "%Y-%m-%d %H:%M:%S"

when using a date string of format:

    "2004-12-31 23:59:00"

with value for seconds:

    "2004-12-31 23:59:79"

example:


struct tm time_data;

if( NULL == ((char *)strptime(date, "%Y-%m-%d %H:%M:%S", &time_data)) )
{
	return(DATA_FORMAT_ERROR);
}



System: 
Debian Sarge
Linux X 2.6.3 #7 SMP Tue Mar 9 17:24:55 CET 2004 i686 GNU/Linux
compiler: gcc version 3.3.5 (Debian 1:3.3.5-5)
libraries:
                      libc5          5.4.46-15
                      libc6          2.3.2.ds1-20
                      binutils       2.15-5 


I have not reported this bug to glibc.


--

thomas


---------------------------------------
Received: (at 291572-done) by bugs.debian.org; 22 Jan 2005 16:33:07 +0000
>From gotom@debian.or.jp Sat Jan 22 08:33:07 2005
Return-path: <gotom@debian.or.jp>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CsOCB-0003EE-00; Sat, 22 Jan 2005 08:33:07 -0800
Received: from omega.webmasters.gr.jp (localhost [127.0.0.1])
	by webmasters.gr.jp (Postfix) with ESMTP
	id 448CCDEB3B; Sun, 23 Jan 2005 01:33:06 +0900 (JST)
Date: Sun, 23 Jan 2005 01:32:56 +0900
Message-ID: <81llalpgp3.wl@omega.webmasters.gr.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: Thomas Finneid <tfinneid@ifi.uio.no>, 291572-done@bugs.debian.org
Subject: Re: Bug#291572: libc: strptime fails to check legal value range for seconds
In-Reply-To: <[🔎] 1106324145.15233.182.camel@pluto>
References: <[🔎] 1106324145.15233.182.camel@pluto>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 291572-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

At Fri, 21 Jan 2005 17:15:45 +0100,
Thomas Finneid wrote:
> The following format specifier fails to validate the seconds argument
> valid value ranges, 0-59. All other values are validated as legal.
> 
>     "%Y-%m-%d %H:%M:%S"
> 
> when using a date string of format:
> 
>     "2004-12-31 23:59:00"
> 
> with value for seconds:
> 
>     "2004-12-31 23:59:79"
> 
> example:
> 
> 
> struct tm time_data;
> 
> if( NULL == ((char *)strptime(date, "%Y-%m-%d %H:%M:%S", &time_data)) )
> {
> 	return(DATA_FORMAT_ERROR);
> }

Read man strptime, your exmaple problem is not complete.  Try this
sample.

	#define DATA1 "2004-12-31 23:59:79"
	#define DATA2 "2004-12-31 23:59:59"
	
	#define _XOPEN_SOURCE
	#include <stdio.h>
	#include <time.h>
	
	void test(char *s)
	{
	  struct tm timed;
	  char *p;
	
	  p = strptime(s, "%Y-%m-%d %H:%M:%S", &timed);
	  if (p == NULL) {
	    printf("completely failed\n");
	    return;
	  }
	  if (*p == '\0') {
	    printf("ok\n");
	    return;
	  }
	  printf("error pointer: %s\n", p);
	  return;
	}
	 
	int main(void)
	{
	  test(DATA1);
	  test(DATA2);
	  return 0;
	}

I close this bug marked as invalid.

Regards,
-- gotom



Reply to: