TEMP-0000000-E110B2.65437ce.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Subject: Limit string printing to 100 chars, and add flags I forgot in the previous commit
  2. ID: TEMP-0000000-E110B2
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Tue Dec 16 23:29:42 2014 +0000
  5. Origin: FILE5_21-13-g65437ce
  6. Last-Update: 2015-01-05
  7. Limit string printing to 100 chars, and add flags I forgot in the previous
  8. commit.
  9. diff --git a/src/readelf.c b/src/readelf.c
  10. index e1cf692..fb2febb 100644
  11. --- a/src/readelf.c
  12. +++ b/src/readelf.c
  13. @@ -906,19 +906,23 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
  14. }
  15. if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0) {
  16. + if (descsz > 100)
  17. + descsz = 100;
  18. switch (xnh_type) {
  19. case NT_NETBSD_VERSION:
  20. return size;
  21. case NT_NETBSD_MARCH:
  22. if (*flags & FLAGS_DID_NETBSD_MARCH)
  23. return size;
  24. - if (file_printf(ms, ", compiled for: %.*s", (int)descsz,
  25. - (const char *)&nbuf[doff]) == -1)
  26. + *flags |= FLAGS_DID_NETBSD_MARCH;
  27. + if (file_printf(ms, ", compiled for: %.*s",
  28. + (int)descsz, (const char *)&nbuf[doff]) == -1)
  29. return size;
  30. break;
  31. case NT_NETBSD_CMODEL:
  32. if (*flags & FLAGS_DID_NETBSD_CMODEL)
  33. return size;
  34. + *flags |= FLAGS_DID_NETBSD_CMODEL;
  35. if (file_printf(ms, ", compiler model: %.*s",
  36. (int)descsz, (const char *)&nbuf[doff]) == -1)
  37. return size;
  38. @@ -926,6 +930,7 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
  39. default:
  40. if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
  41. return size;
  42. + *flags |= FLAGS_DID_NETBSD_UNKNOWN;
  43. if (file_printf(ms, ", note=%u", xnh_type) == -1)
  44. return size;
  45. break;