Guest User

script_extractor argc and SCRIPT_SIZE patch

a guest
Sep 20th, 2015
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.60 KB | None | 0 0
  1. --- script_extractor.c.orig     2015-09-20 14:11:25.896712635 +0200
  2. +++ script_extractor.c  2015-09-20 14:26:01.860734775 +0200
  3. @@ -34,13 +34,13 @@
  4.         fd = open("/dev/mem", O_RDONLY);
  5.  
  6.         size = SCRIPT_SIZE;
  7. -       if (argc)
  8. +       if (argc > 1)
  9.                 size = atoi(argv[1]);
  10.  
  11.         addr = (char *)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, SCRIPT_START);
  12. -       for (i = 0; i < SCRIPT_SIZE; i++)
  13. +       for (i = 0; i < size; i++)
  14.                 putchar(addr[i]);
  15. -       munmap(NULL, SCRIPT_SIZE);
  16. +       munmap(NULL, size);
  17.         close(fd);
  18.  
  19.         return 0;
Advertisement
Add Comment
Please, Sign In to add comment