From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 9C18521A04812 for ; Tue, 4 Apr 2017 20:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491361984; x=1522897984; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=NZ3MS5B2k8hVppIcb26UamVDCypixXO8WEHWgNMKXDY=; b=RN6itgh0PS89AUJ4mMXkvoEX25ngdOFbjGrqTFjvwG/UI9+LgxxpepQy qZdbfF1ncn4XWTq1wCj6i9UjvjUJog==; Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2017 20:13:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,276,1486454400"; d="scan'208";a="1151164673" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 04 Apr 2017 20:13:04 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 4 Apr 2017 20:13:03 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 4 Apr 2017 20:13:03 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.117]) with mapi id 14.03.0319.002; Wed, 5 Apr 2017 11:13:01 +0800 From: "Dong, Eric" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [PATCH v2] MdeModulePkg/UefiHiiLib:Fix incorrect comparison expression Thread-Index: AQHSrbpGo2hnckD/x0CQbXBZs1h7mqG2GYYw Date: Wed, 5 Apr 2017 03:13:00 +0000 Message-ID: References: <1491361841-95824-1-git-send-email-dandan.bi@intel.com> In-Reply-To: <1491361841-95824-1-git-send-email-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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:13:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong -----Original Message----- From: Bi, Dandan=20 Sent: Wednesday, April 5, 2017 11:11 AM To: edk2-devel@lists.01.org Cc: Dong, Eric; Gao, Liming Subject: [PATCH v2] MdeModulePkg/UefiHiiLib:Fix incorrect comparison expres= sion https://bugzilla.tianocore.org/show_bug.cgi?id=3D416 V2: The pointer StringPtr points to a string returned by ExtractConfig/Expo= rtConfig, if it is NULL, function InternalHiiIfrValueAction will return FAL= SE. So in current usage model, the StringPtr can not be NULL before using i= t, 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/Librar= y/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; } =20 StringPtr =3D ConfigAltResp; - - while (StringPtr !=3D L'\0') { + ASSERT (StringPtr !=3D NULL); + + while (*StringPtr !=3D L'\0') { // // 1. Find GUID=3D...&NAME=3D...&PATH=3D... // StringHdr =3D StringPtr; =20 --=20 1.9.5.msysgit.1