cherry-pick.FILE5_33-31-ga642587a.avoid-reading-past-the-end-of-buffer.patch 557 B

123456789101112131415161718
  1. Subject: Avoid reading past the end of buffer (Rui Reis)
  2. Origin: FILE5_33-31-ga642587a
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Sat Jun 9 16:00:06 2018 +0000
  5. Bug-Debian: https://bugs.debian.org/901351
  6. --- a/src/readelf.c
  7. +++ b/src/readelf.c
  8. @@ -825,7 +825,8 @@
  9. cname = (unsigned char *)
  10. &nbuf[doff + prpsoffsets(i)];
  11. - for (cp = cname; *cp && isprint(*cp); cp++)
  12. + for (cp = cname; cp < nbuf + size && *cp
  13. + && isprint(*cp); cp++)
  14. continue;
  15. /*
  16. * Linux apparently appends a space at the end