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

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