From patchwork Thu Dec 15 06:49:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 88115 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp630828qgi; Wed, 14 Dec 2016 22:51:31 -0800 (PST) X-Received: by 10.99.170.79 with SMTP id x15mr1546378pgo.14.1481784691419; Wed, 14 Dec 2016 22:51:31 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 3si951179plu.63.2016.12.14.22.51.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2016 22:51:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2B4F581EA2; Wed, 14 Dec 2016 22:51:31 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: Heyi Guo , Liming Gao MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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");