negative memcpy

Khem Raj raj.khem at gmail.com
Wed Aug 10 02:49:58 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/09/2011 06:22 AM, manish kumar wrote:
> #include<stdio.h> #include<string.h>
> 
> int main() { char *str1[10] = {src}; char *str2[10] = {dest}; 
> memcpy(str1, str2, -1);
> 
> return 1; }
> 
> This simple test case of negative memcpy() fails on PC with glibc,
> but executes well on uClibc on MIPS target. -1 should translate to a
> large positive number and while doing memcpy(), program should
> access illegal memory and should get segmentation fault. This happens
> on PC with glibc environment.
> 
> Why this program runs on uClibc?

can you make sure that its not using the compiler provided builtin memcpy ?

Can you compare the behavior on mips/glibc and mips/uclibc ?

> 
> -Manish _______________________________________________ uClibc
> mailing list uClibc at uclibc.org 
> http://lists.busybox.net/mailman/listinfo/uclibc


- -- 
- -Khem
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk5B8dYACgkQuwUzVZGdMxSECACeOAfDsIT+qWGP9y7BkrNGWd3w
w+4AmgJeiAGK3ZxSPa2f8Q501/9mjK9B
=QeyW
-----END PGP SIGNATURE-----


More information about the uClibc mailing list