From d69cb55c21394a66cae01013ed48cae98427d786 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 12 Mar 2016 17:27:34 -0500 Subject: [PATCH] Add explicit 0-length check out of paranoia --- Sources/Ecc/Main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/Ecc/Main.cpp b/Sources/Ecc/Main.cpp index b478631..71178aa 100644 --- a/Sources/Ecc/Main.cpp +++ b/Sources/Ecc/Main.cpp @@ -246,6 +246,11 @@ ESStatus GetESStatus() // Read a temporary buffer of the entire file contents fseek(_fInput, 0, SEEK_END); size_t length = ftell(_fInput); + + // Hard-stop on Empty out of paranoia + if (length == 0) + return result; + char* temporaryBuffer = (char*)malloc(length); fseek(_fInput, 0, SEEK_SET); fread(temporaryBuffer, length, 1, _fInput);