From 1a50ba665a21676ec06b21bb6ba744b32ac2c4bf Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Sat, 12 Mar 2016 17:36:50 -0500 Subject: [PATCH] Check for NULL return from malloc in es vertification code and print error if es verification fails --- Sources/Ecc/Main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/Ecc/Main.cpp b/Sources/Ecc/Main.cpp index 8168f6e..3f88e62 100644 --- a/Sources/Ecc/Main.cpp +++ b/Sources/Ecc/Main.cpp @@ -252,6 +252,10 @@ ESStatus GetESStatus() return result; char* temporaryBuffer = (char*)malloc(length); + + if (!temporaryBuffer) + return ESStatus::Error; + fseek(_fInput, 0, SEEK_SET); fread(temporaryBuffer, length, 1, _fInput); fseek(_fInput, 0, SEEK_SET); @@ -398,6 +402,7 @@ int main(int argc, char *argv[]) case ESStatus::Error: { fclose(_fInput); + printf("Ecc encountered an error during the es verification.\n"); return EXIT_FAILURE; } }