[BUG] memccpy treats size_t as int

David A. Ramos daramos@stanford.edu
Wed Sep 22 03:15:00 GMT 2010


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




More information about the Newlib mailing list