From 3241d1b18c65d53ab81388996a64ea3320f3dc6c Mon Sep 17 00:00:00 2001 From: 43313EB9AA87E7039F8F3948282E61C0CB12372C5499884609A01B2BCA37B973 <36488804+iadgovuser34@users.noreply.github.com> Date: Thu, 11 Feb 2021 13:29:34 -0500 Subject: [PATCH] Update esl-parser.c Fix string initialization mistakes (I am rusty at C programming!). --- secureboot/esl-parser.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/secureboot/esl-parser.c b/secureboot/esl-parser.c index 362c2a6..d3fc0b4 100644 --- a/secureboot/esl-parser.c +++ b/secureboot/esl-parser.c @@ -99,7 +99,7 @@ int parseHashes(bool debug, bool silent, FILE *infile, unsigned int hashcount, u records = 0, readcount = 0; unsigned char *buf = NULL, - outfilenameEX[strlen(outfilename + 4)]; + outfilenameEX[MAX_FILENAME_LENGTH + 4] = ""; FILE *outfile = NULL; //read the structure sizing and record count info @@ -111,7 +111,6 @@ int parseHashes(bool debug, bool silent, FILE *infile, unsigned int hashcount, u if(debug) printf("Parsing hash list\n listsize %i, header %i, sigsize %i, records %i\n", listsize, headersize, sigsize, records); //add the txt extension to the filename - outfilenameEX[0] = '\0'; strcat(outfilenameEX, outfilename); strcat(outfilenameEX, ".txt"); @@ -166,7 +165,7 @@ int parseCerts(bool debug, bool silent, FILE *infile, unsigned int certcount, un records = 0, readcount = 0; unsigned char *buf = NULL, - outfilenameEX[MAX_FILENAME_LENGTH + 7], + outfilenameEX[MAX_FILENAME_LENGTH + 7] = "", temp[4]; FILE *outfile = NULL; @@ -179,7 +178,6 @@ int parseCerts(bool debug, bool silent, FILE *infile, unsigned int certcount, un if(debug) printf("Parsing cert list\n listsize %i, header %i, sigsize %i, records %i\n", listsize, headersize, sigsize, records); //null terminate the outfile name - outfilenameEX[0] = '\0'; strcat(outfilenameEX, outfilename); //make a buffer big enough to contaiin each cert