bin/93197: strptime(3) succeeds on formats it should fail on

Andreas S. Wetzel mickey242 at gmx.net
Sat Feb 11 12:00:22 PST 2006


>Number:         93197
>Category:       bin
>Synopsis:       strptime(3) succeeds on formats it should fail on
>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:   Sat Feb 11 20:00:20 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Andreas S. Wetzel
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD transrapid.enforcer.cc 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Jan 5 18:34:54 CET 2006 root at transrapid.enforcer.cc:/usr/src/sys/i386/compile/TRANSRAPID i386


	
>Description:
	The strptime(3) function succeeds with input that it should fail on according to the given format string.
	Excerpt from the strptime(3) manpage:
	   It returns NULL if one of the conversions failed.
>How-To-Repeat:
	Compile and run this test program. strptime() should obviously fail on input 'March' cause format '%d'
	is not satisfied.
	
#include <stdio.h>
#include <time.h>

int main(int argc, char *argv[])
{
        struct tm tm;
        char *date="March";
        char *test=strptime(date, "%B %d", &tm);
                        
        if(test)
                printf("Broken\n");
        else
                printf("OK\n");

        return 0;
}
                                                
>Fix:

	


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list