BlockdumpFileReader: Extra error checking to detection

This commit is contained in:
Connor McLaughlin 2022-05-25 22:35:46 +10:00 committed by refractionpcsx2
parent 628560850a
commit 425b5d0478
1 changed files with 3 additions and 4 deletions

View File

@ -35,10 +35,9 @@ bool BlockdumpFileReader::DetectBlockdump(AsyncFileReader* reader)
reader->SetBlockSize(1); reader->SetBlockSize(1);
char buf[5] = {0}; char buf[4] = {0};
reader->ReadSync(buf, 0, 4); bool isbd = (reader->ReadSync(buf, 0, sizeof(buf)) == 4 &&
std::memcmp(buf, "BDV2", sizeof(buf)) == 0);
bool isbd = (strncmp(buf, "BDV2", 4) == 0);
if (!isbd) if (!isbd)
reader->SetBlockSize(oldbs); reader->SetBlockSize(oldbs);