909-file-coredump.patch 974 B

12345678910111213141516171819202122232425262728293031323334
  1. Author: Arnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
  2. Description:
  3. File does not always correctly report the faulty command for core files
  4. anymore.
  5. diff -Naurp file.orig/src/readelf.c file/src/readelf.c
  6. --- file.orig/src/readelf.c 2010-07-11 00:17:48.717928843 +0200
  7. +++ file/src/readelf.c 2010-07-13 16:45:37.341674011 +0200
  8. @@ -738,6 +738,25 @@ core:
  9. /*
  10. * Well, that worked.
  11. */
  12. +
  13. + /*
  14. + * Try next offsets, in case this match is
  15. + * in the middle of a string.
  16. + */
  17. + size_t k;
  18. + for (k = i + 1 ; k < NOFFSETS ; k++) {
  19. + if (prpsoffsets(k) >= prpsoffsets(i))
  20. + continue;
  21. + size_t no;
  22. + int adjust = 1;
  23. + for (no = doff + prpsoffsets(k);
  24. + no < doff + prpsoffsets(i); no++)
  25. + adjust = adjust
  26. + && isprint(nbuf[no]);
  27. + if (adjust)
  28. + i = k;
  29. + }
  30. +
  31. cname = (unsigned char *)
  32. &nbuf[doff + prpsoffsets(i)];
  33. for (cp = cname; *cp && isprint(*cp); cp++)