From 5375a2a048a5cbc5448ebd731927c9b843e7a571 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 26 Dec 2019 17:03:44 +0100 Subject: COMMON: Add sanity check to MacResMan --- common/macresman.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/macresman.cpp b/common/macresman.cpp index ac78ea0bd0..29d3ddef99 100644 --- a/common/macresman.cpp +++ b/common/macresman.cpp @@ -376,7 +376,8 @@ bool MacResManager::isMacBinary(SeekableReadStream &stream) { byte infoHeader[MBI_INFOHDR]; int resForkOffset = -1; - stream.read(infoHeader, MBI_INFOHDR); + if (stream.read(infoHeader, MBI_INFOHDR) != MBI_INFOHDR) + return false; if (infoHeader[MBI_ZERO1] == 0 && infoHeader[MBI_ZERO2] == 0 && infoHeader[MBI_ZERO3] == 0 && infoHeader[MBI_NAMELEN] <= MAXNAMELEN) { -- cgit v1.2.3