CVE-2014-8116.2.d7cdad0.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Subject: Stop reporting bad capabilities after the first few
  2. ID: CVE-2014-8116
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Sat Nov 22 23:57:44 2014 +0000
  5. Origin: FILE5_20-28-gd7cdad0
  6. Last-Update: 2015-01-05
  7. diff --git a/src/readelf.c b/src/readelf.c
  8. index 5a6dd41..e0b252d 100644
  9. --- a/src/readelf.c
  10. +++ b/src/readelf.c
  11. @@ -923,6 +923,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
  12. Elf32_Shdr sh32;
  13. Elf64_Shdr sh64;
  14. int stripped = 1;
  15. + size_t nbadcap = 0;
  16. void *nbuf;
  17. off_t noff, coff, name_off;
  18. uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */
  19. @@ -995,6 +996,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
  20. free(nbuf);
  21. break;
  22. case SHT_SUNW_cap:
  23. + if (nbadcap > 5)
  24. + break;
  25. if (lseek(fd, (off_t)xsh_offset, SEEK_SET) ==
  26. (off_t)-1) {
  27. file_badseek(ms);
  28. @@ -1031,6 +1034,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
  29. (unsigned long long)xcap_tag,
  30. (unsigned long long)xcap_val) == -1)
  31. return -1;
  32. + if (nbadcap++ > 2)
  33. + coff = xsh_size;
  34. break;
  35. }
  36. }