Fix #10585 - crash in fatmach0

This commit is contained in:
pancake 2018-07-09 12:57:59 +02:00
parent f3608b24d3
commit ad11c11232

View File

@ -18,7 +18,7 @@ static bool checkHeader(const ut8 *h, int sz) {
if (sz >= 0x300 && !memcmp (h, "\xca\xfe\xba\xbe", 4)) {
// XXX assuming BE
int off = r_read_at_be32 (h, 4 * sizeof (int));
if (off > 0 && off + 4 < sz) {
if (off > 0 && off + h + 4 < sz) {
memcpy (buf, h + off, 4);
if (!memcmp (buf, "\xce\xfa\xed\xfe", 4) ||
!memcmp (buf, "\xfe\xed\xfa\xce", 4) ||