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

Re: protection against buffer overflows



hi,

>  anyone to offer any
> explanation will be showered with greatness!

here is an example:

#include <stdio.h>

void example()
{
  char a[10];
  char b[10];
  strcpy(a, "123456789");
  printf ("a: %s\n", a);
  b[20]='X';
  b[21]='Y';
  b[22]='Z';
  printf("a: %s\n", a);
  return;
}
main()
{
example();
}

debian:/tmp# ./example
a: 123456789
a: 12345678XYZ¿|ýÿ¿?0

now imagine you receive the numbers 20, 21 and 22 and letters X, Y and Z
from user input.

bye
Ralf



Reply to: