negative memcpy

Denys Vlasenko vda.linux at googlemail.com
Wed Aug 10 02:52:31 UTC 2011


On Tue, Aug 9, 2011 at 3:22 PM, manish kumar <deliver2manish at gmail.com> 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?

objdump -dr BINARY ?


More information about the uClibc mailing list