Bug 16429 - strptime truncate 64bit pointer to 32bit
Summary: strptime truncate 64bit pointer to 32bit
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 12:05 UTC by hxnhxn
Modified: 2014-06-13 09:04 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.