Getting rid of alignment faults in userspace

Nicolas Pitre nicolas.pitre at linaro.org
Sat Jun 18 18:42:41 UTC 2011


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



More information about the ubuntu-devel mailing list