1434503415.aoetools-36-2-ge50247f.check-amount-of-data-read-from-network-before-using-it.patch 631 B

123456789101112131415161718
  1. Subject: Check amount of data read from network before using it
  2. Origin: aoetools-36-2-ge50247f <https://github.com/OpenAoE/aoetools/commit/aoetools-36-2-ge50247f>
  3. Upstream-Author: Ed Cashin <ed.cashin@acm.org>
  4. Date: Tue Jun 16 21:10:15 2015 -0400
  5. Forwarded: not-needed (cherry-picked)
  6. --- a/aoeping.c
  7. +++ b/aoeping.c
  8. @@ -359,6 +359,9 @@
  9. }
  10. n = aoe_pkt_read(buf, sizeof buf, c, tag);
  11. p = (Ata *) buf;
  12. + /* We're expecting the AoE and ATA header plus 512 bytes of SMART */
  13. + if (n < 512 + (&p->data[0] - (uchar *) p))
  14. + exit(EXIT_FAILURE);
  15. if (show_smart_regs(p) != 0)
  16. exit(EXIT_FAILURE);
  17. if (s->data & SmartDataRet) {