fix-segv-from-loop-overrun.patch 597 B

1234567891011121314151617
  1. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  2. Date: Thu Jan 28 23:25:18 2010 +0000
  3. Upstream-Commit: 0d74a0ec9fc45bd0887b157747012a3aa694f4ae
  4. Description:
  5. fix segv from loop overrun
  6. --- a/src/softmagic.c
  7. +++ b/src/softmagic.c
  8. @@ -945,7 +945,7 @@
  9. buf = (const char *)s + offset;
  10. end = last = (const char *)s + nbytes;
  11. /* mget() guarantees buf <= last */
  12. - for (lines = linecnt, b = buf; lines &&
  13. + for (lines = linecnt, b = buf; lines && b < end &&
  14. ((b = CAST(const char *,
  15. memchr(c = b, '\n', CAST(size_t, (end - b)))))
  16. || (b = CAST(const char *,