cherry-pick.FILE5_34-18-gbd8fafe3.check-file-printf.patch 737 B

12345678910111213141516171819202122
  1. Subject: Check file_printf()
  2. Origin: FILE5_34-18-gbd8fafe3 <https://github.com/file/file/commit/FILE5_34-18-gbd8fafe3>
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Wed Aug 1 10:09:47 2018 +0000
  5. --- a/src/readelf.c
  6. +++ b/src/readelf.c
  7. @@ -545,9 +545,11 @@
  8. size_t noff, size_t doff, int *flags)
  9. {
  10. if (namesz == 5 && strcmp((char *)&nbuf[noff], "SuSE") == 0 &&
  11. - type == NT_GNU_VERSION && descsz == 2) {
  12. - *flags |= FLAGS_DID_OS_NOTE;
  13. - file_printf(ms, ", for SuSE %d.%d", nbuf[doff], nbuf[doff + 1]);
  14. + type == NT_GNU_VERSION && descsz == 2) {
  15. + *flags |= FLAGS_DID_OS_NOTE;
  16. + if (file_printf(ms, ", for SuSE %d.%d", nbuf[doff],
  17. + nbuf[doff + 1]) == -1)
  18. + return -1;
  19. return 1;
  20. }