Menu

#2 getFileType error on non-MZ

open
nobody
PeLib (2)
5
2007-04-16
2007-04-16
Anonymous
No

in the openPeFile call,
in the getFileType call

you check the return from mzHeader.read() blah for NO_ERROR, however

in mzHeader::read so long as the file is big enough to hold the buffer, it will return NO_ERROR (even for NON-MZ files).

This is a serious error and can be fixed by the following .

Replace:

return NO_ERROR;

with:

if (vBuffer[0] == 'M' && vBuffer[1] == 'Z')
return NO_ERROR;
else
return ERROR_INVALID_FILE;

Discussion


Log in to post a comment.