SHARE
TWEET

BufferOverflowExample

miguelangelgarcia May 10th, 2014 462 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <unistd.h>
  4.  
  5. void greet (char *arg)
  6. {
  7.         char name[32];
  8.         strcpy(name, arg);
  9.         printf("Hi %s\n", name);
  10. }
  11.  
  12. int main (int argc, char *argv[])
  13. {
  14.         sleep(1);
  15.        
  16.         if(argc!=2)
  17.         {
  18.                 printf("Example: %s NAME\n", argv[0]);
  19.         }
  20.         else
  21.         {
  22.                 greet(argv[1]);
  23.         }
  24.        
  25.         return 0;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top