This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[BUG] memccpy treats size_t as int
- From: "David A. Ramos" <daramos at stanford dot edu>
- To: newlib at sourceware dot org
- Date: Tue, 21 Sep 2010 13:51:46 -0700
- Subject: [BUG] memccpy treats size_t as int
Hi newlib maintainers,
It's come to my attention that newlib's memccpy (libc/string/memccpy.c) casts the len0 argument from size_t (as required by the SUS) to int. On 64-bit Linux environments, this erroneously drops the high 32 bits. I'm not familiar enough with newlib to know whether this issue is isolated to memccpy or whether it's standard practice in the project. Just thought I'd report it!
More specifically:
int len = len0;
should be:
size_t len = len0;
-David