document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. int limit, c;
  6.  
  7. int getebp()
  8. {
  9.     __asm__("movl %ebp, %eax");
  10. }
  11.  
  12. int proc(char *nombre)
  13. {
  14.     int *i;
  15.     char buffer[256];
  16.  
  17.     i = (int *) getebp(); /* obtiene la dirección de EBP */
  18.     limit = *i - (int)buffer + 4; /* se calcula la distancia entre el buffer y EBP y se le suma 4 <- BUG) */
  19.  
  20.     for (c = 0; c < limit && nombre[c] != \'\\0\'; c++)
  21.         buffer[c] = nombre[c];
  22.  
  23.     printf("\\nEncantado de conocerte: %s\\n", buffer);
  24.     return 0;
  25. }
  26.  
  27. int main(int argc, char *argv[])
  28. {
  29.     if (argc < 2) {
  30.         fprintf(stderr, "\\nUso: %s \\n", argv[0]);
  31.         exit(0);
  32.     }
  33.    
  34.     proc(argv[1]);
  35.  
  36.     return 0;
  37. }
');