Advertisement
Quisqueite

stack_7

Feb 18th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. void getString()
  7. {
  8.   char buffer[64];
  9.   unsigned int ret;
  10.  
  11.   printf("Input string: "); fflush(stdout);
  12.  
  13.   gets(buffer);
  14.  
  15.   ret = __builtin_return_address(0);
  16.  
  17.   if((ret & 0xbf000000) == 0xbf000000) {
  18.       printf("bzzzt (%p)\n", ret);
  19.       _exit(1);
  20.   }
  21.  
  22.   printf("Got string %s\n", buffer);
  23. }
  24.  
  25. int main(int argc, char **argv)
  26. {
  27.   getString();
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement