From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 D7DD621A04812 for ; Tue, 4 Apr 2017 20:10:52 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 04 Apr 2017 20:10:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,276,1486454400"; d="scan'208";a="84519711" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga005.fm.intel.com with ESMTP; 04 Apr 2017 20:10:50 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Eric Dong , Liming Gao Date: Wed, 5 Apr 2017 11:10:41 +0800 Message-Id: <1491361841-95824-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [PATCH v2] MdeModulePkg/UefiHiiLib:Fix incorrect comparison expression 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: Wed, 05 Apr 2017 03:10:53 -0000 https://bugzilla.tianocore.org/show_bug.cgi?id=416 V2: The pointer StringPtr points to a string returned by ExtractConfig/ExportConfig, if it is NULL, function InternalHiiIfrValueAction will return FALSE. So in current usage model, the StringPtr can not be NULL before using it, so we can add ASSERT here. Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index a2abf26..cd0cd35 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -2199,12 +2199,13 @@ InternalHiiIfrValueAction ( if (EFI_ERROR (Status)) { return FALSE; } StringPtr = ConfigAltResp; - - while (StringPtr != L'\0') { + ASSERT (StringPtr != NULL); + + while (*StringPtr != L'\0') { // // 1. Find GUID=...&NAME=...&PATH=... // StringHdr = StringPtr; -- 1.9.5.msysgit.1