From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com [IPv6:2607:f8b0:400e:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BB7A981E0C for ; Wed, 14 Dec 2016 22:51:29 -0800 (PST) Received: by mail-pg0-x22e.google.com with SMTP id x23so16921810pgx.1 for ; Wed, 14 Dec 2016 22:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qNwZVaKdtBZQkRM28mA3lbxS/ivMLyhh+oOzN5PlVa4=; b=ch9Fp21mtX/1h66HHP0Rpowmf78RkaxTjbyWzRrjLa/oyao/b2+FiaJeiE88b+E2XF K+FuHGzFAllZrJaPy5G6WUDJIXqnJs4d2ffHYO2jCR8MRtObwsTMcsunbjiflAQTvoFJ Umi/HU6xaCsTbKzkb0OdAnctCLZAhmuh/LHOI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qNwZVaKdtBZQkRM28mA3lbxS/ivMLyhh+oOzN5PlVa4=; b=LjkUCoG5Dff8GJj8HzJGp5m8RtehoajdCXAPxn7GR0dmPClijWiZ2CKmq4WYKBx/N5 iBstYXYkcAJpS9d6qy9w00LhMkuaGblCs2R+4zpNQQm9tGkqniXmQLRhOEHXPrph3zzF p1P3yzFlzp1X3ZX9Neg2ZxDZn7Da9tYp7OqJu7FkaI4tj+5CBd5Gv+rnOzxBo3JmxuvP /Y3hvkySoRun3dDyovbct9bw/bm5uzhz/oIsJxgY34QyFQYpy9tLK+SNND9duJMtDDcd sRHkEgEJwgm2yR+4liJRw5e70zfzOCGzh+ONHrBiHpBBnCjuR5M7+Wh8l320PXF3ugtI u1XQ== X-Gm-Message-State: AKaTC01F9SYSreN0+/IDlX1fJtwgg3R4hRcIFEfeddnqezyphyLQFoE8AFrzWrs9HZnQfs/C X-Received: by 10.84.225.22 with SMTP id t22mr1783730plj.76.1481784689299; Wed, 14 Dec 2016 22:51:29 -0800 (PST) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id y89sm1377007pfk.83.2016.12.14.22.51.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Dec 2016 22:51:28 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Cc: Heyi Guo , Yonghong Zhu , Liming Gao Date: Thu, 15 Dec 2016 14:49:45 +0800 Message-Id: <1481784588-35336-2-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481784588-35336-1-git-send-email-heyi.guo@linaro.org> References: <1481784588-35336-1-git-send-email-heyi.guo@linaro.org> Subject: [PATCH 1/4] BaseTools: fix format-security build warnings X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2016 06:51:29 -0000 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 Cc: Yonghong Zhu Cc: Liming Gao --- 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