Add explicit 0-length check out of paranoia

This commit is contained in:
Robert MacGregor 2016-03-12 17:27:34 -05:00
parent 609d71437f
commit d69cb55c21

View File

@ -246,6 +246,11 @@ ESStatus GetESStatus()
// Read a temporary buffer of the entire file contents // Read a temporary buffer of the entire file contents
fseek(_fInput, 0, SEEK_END); fseek(_fInput, 0, SEEK_END);
size_t length = ftell(_fInput); size_t length = ftell(_fInput);
// Hard-stop on Empty out of paranoia
if (length == 0)
return result;
char* temporaryBuffer = (char*)malloc(length); char* temporaryBuffer = (char*)malloc(length);
fseek(_fInput, 0, SEEK_SET); fseek(_fInput, 0, SEEK_SET);
fread(temporaryBuffer, length, 1, _fInput); fread(temporaryBuffer, length, 1, _fInput);