Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Weird execution path caused by stack buffer overflow
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. void fun1 ( char * input ) {
  6.     char buffer[10];
  7.     strcpy( buffer, input );
  8.     printf( "In fun1, buffer= %sn", buffer );
  9. }
  10.  
  11. void fun2 ( void ) {
  12.     printf ( "HELLO fun2!n" );
  13. }
  14.  
  15. int main ( int argc, char * argv[] )
  16. {
  17.     printf ( "Address of fun2: %pn", fun2 );
  18.     fun1( "abcdefghijklmnopqrstuvx52x84x04x08" );
  19.     return 0;
  20. }