Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5.  
  6.  
  7. void overflow(char *source) {
  8.  
  9.     char buf[128];
  10.  
  11.     strcpy(buf, source);
  12.    
  13.     printf("Buf: %s\n", buf);
  14.  
  15. }
  16.  
  17.  
  18. int main(int argc, char **argv) {
  19.  
  20.     setuid(0);
  21.  
  22.     printf("Arg: %s\n", argv[1]);
  23.  
  24.     overflow(argv[1]);
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement