CVE-2014-9653.1.4c948c0.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. Subject: Fix previous, reading section name
  2. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  3. Date: Fri Feb 22 01:35:49 2013 +0000
  4. Origin: FILE5_12-68-g4c948c0
  5. Last-Update: 2015-02-15
  6. (prequisite for CVE-2014-9653)
  7. --- a/src/readelf.c
  8. +++ b/src/readelf.c
  9. @@ -1013,18 +1013,23 @@
  10. return 0;
  11. }
  12. - /* Save offset of name section to be able to read section names later */
  13. - name_off = off * size * strtab;
  14. - /* Read the name of this section. */
  15. - if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
  16. + /* Read offset of name section to be able to read section names later */
  17. + if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) == -1) {
  18. file_badread(ms);
  19. return -1;
  20. }
  21. - name[sizeof(name) - 1] = '\0';
  22. - if (strcmp(name, ".debug_info") == 0)
  23. - stripped = 0;
  24. + name_off = xsh_offset;
  25. for ( ; num; num--) {
  26. + /* Read the name of this section. */
  27. + if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
  28. + file_badread(ms);
  29. + return -1;
  30. + }
  31. + name[sizeof(name) - 1] = '\0';
  32. + if (strcmp(name, ".debug_info") == 0)
  33. + stripped = 0;
  34. +
  35. if (pread(fd, xsh_addr, xsh_sizeof, off) < (ssize_t)xsh_sizeof) {
  36. file_badread(ms);
  37. return -1;