Bug 16429

Summary: strptime truncate 64bit pointer to 32bit
Product: glibc Reporter: hxnhxn
Component: libcAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: bugdal, drepper.fsp, neleai
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description hxnhxn 2014-01-10 12:05:25 UTC
under 64-bit enviroment, when input an 64-bit pointer as arg1 to strptime, e.g, a char[] array, it will return a pointer with higher 4 bytes set to zero. 
for example:

char timestr[655] = "2011-11-27T23:06:23qi/ning";
struct tm t;
char * ret = strptime(timestr, "%FT%H:%M:%S", &t);
printf("%llx %llx\n", ret, timestr);
printf("%c\n", *ret);
Comment 1 Ondrej Bilka 2014-01-10 13:25:28 UTC
Cannot replicate on x86-64.

Test program returns:

7fffffffe633 7fffffffe620
q

which has upper bytes nonzero.
Comment 2 Rich Felker 2014-01-10 20:01:01 UTC
Next time try compiling with -Werror=implicit-function-declaration. You may also want to file a bug report with GCC requesting that this be made default, since use of implicit function declarations is always an error and is a constraint violation.