public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Heyi Guo <heyi.guo@linaro.org>
To: edk2-devel@lists.01.org
Cc: Heyi Guo <heyi.guo@linaro.org>,
	Yonghong Zhu <yonghong.zhu@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: [PATCH 1/4] BaseTools: fix format-security build warnings
Date: Thu, 15 Dec 2016 14:49:45 +0800	[thread overview]
Message-ID: <1481784588-35336-2-git-send-email-heyi.guo@linaro.org> (raw)
In-Reply-To: <1481784588-35336-1-git-send-email-heyi.guo@linaro.org>

Fix build warnings of "format not a string literal and no format
arguments [-Wformat-security]" for BaseTools, while using "gcc version
4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c | 2 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c   | 2 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c   | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
index 7f686a5..fe1b4d6 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/fset2.c
@@ -2210,7 +2210,7 @@ void MR_backTraceReport()
       if (p->ntype != nToken) continue;
       tn=(TokNode *)p;
       if (depth != 0) fprintf(stdout," ");
-      fprintf(stdout,TerminalString(tn->token));
+      fprintf(stdout, "%s", TerminalString(tn->token));
       depth++;
       if (! MR_AmbAidMultiple) {
         if (set_nil(tn->tset)) {
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
index 368a96b..b990545 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/gen.c
@@ -3866,7 +3866,7 @@ int file;
 /* MR10 */    _gen(" *  ");
 /* MR10 */    for (i=0 ; i < Save_argc ; i++) {
 /* MR10 */      _gen(" ");
-/* MR10 */      _gen(Save_argv[i]);
+/* MR10 */      _gen1("%s", Save_argv[i]);
 /* MR10 */    };
 	_gen("\n");
 	_gen(" *\n");
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
index 8c524fe..a4e7f69 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/lex.c
@@ -706,7 +706,7 @@ FILE *output;
 /* MR26 */			if (! (isalpha(*t) || isdigit(*t) || *t == '_' || *t == '$')) break;
 /* MR26 */		}
 /* MR26 */	}
-/* MR26 */	fprintf(output,strBetween(pSymbol, t, pSeparator));
+/* MR26 */	fprintf(output, "%s", strBetween(pSymbol, t, pSeparator));
 
     *q = p;
     return (*pSeparator  == 0);
@@ -771,7 +771,7 @@ FILE *f;
 				  &pValue,
 				  &pSeparator,
 				  &nest);
-	fprintf(f,strBetween(pDataType, pSymbol, pSeparator));
+	fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
 }
 
 /* check to see if string e is a word in string s */
@@ -852,9 +852,9 @@ int i;
 					  &pSeparator,
 					  &nest);
 		fprintf(f,"\t");
-		fprintf(f,strBetween(pDataType, pSymbol, pSeparator));
+		fprintf(f, "%s", strBetween(pDataType, pSymbol, pSeparator));
 		fprintf(f," ");
-		fprintf(f,strBetween(pSymbol, pEqualSign, pSeparator));
+		fprintf(f, "%s", strBetween(pSymbol, pEqualSign, pSeparator));
 		fprintf(f,";\n");
     }
 	fprintf(f,"};\n");
-- 
1.9.1



  reply	other threads:[~2016-12-15  6:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15  6:49 [PATCH 0/4] Fix GCC build warnings for BaseTools Heyi Guo
2016-12-15  6:49 ` Heyi Guo [this message]
2016-12-15  6:49 ` [PATCH 2/4] BaseTools: fix format type build warnings Heyi Guo
2016-12-15  6:49 ` [PATCH 3/4] BaseTools: fix write-strings " Heyi Guo
2016-12-15  6:49 ` [PATCH 4/4] BaseTools: fix unused-result " Heyi Guo
2016-12-16  4:53 ` [PATCH 0/4] Fix GCC build warnings for BaseTools Gao, Liming
2016-12-16  6:47   ` Heyi Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481784588-35336-2-git-send-email-heyi.guo@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox