cherry-pick.FILE5_35-52-g94b7501f.pr-62-spinpx-avoid-non-nul-terminated-string-read.patch 693 B

1234567891011121314151617181920
  1. Subject: PR/62: spinpx: Avoid non-nul-terminated string read
  2. ID: CVE-2019-8904
  3. Origin: FILE5_35-52-g94b7501f <https://github.com/file/file/commit/FILE5_35-52-g94b7501f>
  4. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  5. Date: Mon Feb 18 17:30:41 2019 +0000
  6. Bug-Debian: https://bugs.debian.org/922967
  7. --- a/src/readelf.c
  8. +++ b/src/readelf.c
  9. @@ -563,8 +563,8 @@
  10. }
  11. if (namesz == 4 && strcmp((char *)&nbuf[noff], "Go") == 0 &&
  12. type == NT_GO_BUILD_ID && descsz < 128) {
  13. - if (file_printf(ms, ", Go BuildID=%s",
  14. - (char *)&nbuf[doff]) == -1)
  15. + if (file_printf(ms, ", Go BuildID=%.*s",
  16. + CAST(int, descsz), CAST(char *, &nbuf[doff])) == -1)
  17. return -1;
  18. return 1;
  19. }