[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting rid of alignment faults in userspace



On Sat, 18 Jun 2011, Nicolas Pitre wrote:

> int main(int argc, char * argv[])
> {
>      char buf[8];
>      void *v = &buf[1];
>      unsigned int *p = (unsigned int *)v;
> 
>      strcpy(buf, "abcdefg");
> 
>      printf("*%p = 0x%08x\n", p, *p);
> 
>      return 0;
> }

Obviously, there is a buffer overflow here, so the buf array should be 
enlarged.


Nicolas


Reply to: