Skip to content

Commit

Permalink
dmo.cpp: Remove file extension check
Browse files Browse the repository at this point in the history
File data decryption verifies a 16 bit checksum and the unpacked
data contains a 22 byte signature. That's more than enough to
identify the file format without relying on the extension.
  • Loading branch information
miller-alex committed Nov 17, 2020
1 parent 0bf8365 commit 1ddbc39
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/dmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,15 @@ CPlayer *CdmoLoader::factory(Copl *newopl)

bool CdmoLoader::load(const std::string &filename, const CFileProvider &fp)
{
int i,j;
binistream *f;
int i, j;

binistream *f = fp.open(filename);
if (!f) return false;

// check header
dmo_unpacker *unpacker = new dmo_unpacker;
unsigned char chkhdr[16];

if(!fp.extension(filename, ".dmo"))
{
delete unpacker;
return false;
}

f = fp.open(filename);
if(!f)
{
delete unpacker;
return false;
}

f->readString((char *)chkhdr, 16);

if (!unpacker->decrypt(chkhdr, 16))
Expand Down

0 comments on commit 1ddbc39

Please sign in to comment.