agrep-fix-double-free.patch 779 B

12345678910111213141516171819202122232425262728
  1. Author: Stefan Weil <sw@weilnetz.de>
  2. Description: Fix crash caused by double free
  3. Bug-Debian: https://bugs.debian.org/869220
  4. Forwarded: https://github.com/Wikinaut/agrep/pull/13
  5. --- a/agrep/asearch.c
  6. +++ b/agrep/asearch.c
  7. @@ -254,7 +254,6 @@ Nextchar1file:
  8. {
  9. if(FILENAMEONLY && (NEW_FILE || !POST_FILTER)) {
  10. num_of_matched++;
  11. - free_buf(text, buffer);
  12. if (agrep_finalfp != NULL)
  13. fprintf(agrep_finalfp, "%s", CurrentFileName);
  14. --- a/agrep/sgrep.c
  15. +++ b/agrep/sgrep.c
  16. @@ -1079,7 +1079,9 @@ register CHARTYPE *text, *textend, *pat,
  17. CHARTYPE *lastout = text;
  18. int newlen;
  19. - Candidate[0][0] = Candidate[0][1] = 0;
  20. + Candidate[0][0] = 0;
  21. + Candidate[0][1] = 0;
  22. + Candidate[1][0] = 0;
  23. d1 = shift_1;
  24. cdx = 0;
  25. if(m < 3) r1 = m;