From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B32C22035BA25 for ; Mon, 18 Dec 2017 19:24:34 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Dec 2017 19:29:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,424,1508828400"; d="scan'208";a="188196686" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.10]) by fmsmga006.fm.intel.com with ESMTP; 18 Dec 2017 19:29:18 -0800 From: Hao Wu To: edk2-devel@lists.01.org Cc: Hao Wu , Liming Gao , Yonghong Zhu Date: Tue, 19 Dec 2017 11:28:55 +0800 Message-Id: <20171219032912.14404-1-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 Subject: [PATCH 00/17] BaseTools/C: Code refinements X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2017 03:24:34 -0000 The series refines the C/C++ source codes within BaseTools for the below catagories: * Resolve uninitialized: Local variables and Class variables in constructor * Add/refine boundary checks when accessing (string) buffers. * Add/refine status checks for the usage of file handles * Remove redundant explicit type casts * Resolve possible resource/memory leaks * Resolve possible NULL pointer dereferences Cc: Liming Gao Cc: Yonghong Zhu Hao Wu (17): BaseTools/C/Common: Add checks for array access BaseTools/EfiRom: Refine the logic in main() BaseTools/LzmaCompress: Fix possible uninitialized variable BaseTools/C/Common: Remove redundant type cast BaseTools/VfrCompile: Assign 'NULL' for closed file handle BaseTools/GenFv: Add check to ensure the file handle status is correct BaseTools/C/Common: Add/refine boundary checks for strcpy/strcat calls BaseTools/C/Common: Refine using sprintf() with '%s' in format string BaseTools/EfiRom: Add/refine boundary checks for strcpy/strcat calls BaseTools/GenBootSector: Add/refine boundary checks for strcpy/strcat BaseTools/GenFv: Add/refine boundary checks for strcpy/strcat calls BaseTools/GenVtf: Add/refine boundary checks for strcpy/strcat calls BaseTools/VfrCompile: Add/refine boundary checks for strcpy/strcat BaseTools/VfrCompile: Resolve uninit class variables in constructor BaseTools/GenFfs: Enlarge the size of 'AlignmentBuffer' BaseTools/GenSec: Fix potential memory leak BaseTools/GenSec: Fix potential null pointer dereference BaseTools/Source/C/Common/BasePeCoff.c | 12 +++---- BaseTools/Source/C/Common/CommonLib.c | 24 +++++++++---- BaseTools/Source/C/Common/Decompress.c | 8 ++--- BaseTools/Source/C/Common/EfiUtilityMsgs.c | 30 ++++++++--------- BaseTools/Source/C/Common/SimpleFileParsing.c | 12 +++---- BaseTools/Source/C/EfiRom/EfiRom.c | 20 +++++++---- BaseTools/Source/C/GenBootSector/GenBootSector.c | 17 ++++++++-- BaseTools/Source/C/GenFfs/GenFfs.c | 7 +++- BaseTools/Source/C/GenFv/GenFv.c | 38 +++++++++++---------- BaseTools/Source/C/GenFv/GenFvInternalLib.c | 26 +++++++++++--- BaseTools/Source/C/GenSec/GenSec.c | 22 +++++++++++- BaseTools/Source/C/GenVtf/GenVtf.c | 43 ++++++++++++++++++++---- BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c | 2 +- BaseTools/Source/C/VfrCompile/VfrCompiler.cpp | 3 +- BaseTools/Source/C/VfrCompile/VfrError.cpp | 1 + BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 6 ++++ BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 17 +++++++--- 17 files changed, 204 insertions(+), 84 deletions(-) -- 2.12.0.windows.1