From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 56C2521179256 for ; Mon, 15 Oct 2018 22:11:33 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2018 22:11:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,387,1534834800"; d="scan'208";a="100574922" Received: from shzintpr01.sh.intel.com (HELO [10.7.209.21]) ([10.239.4.80]) by orsmga002.jf.intel.com with ESMTP; 15 Oct 2018 22:11:32 -0700 To: Ruiyu Ni , edk2-devel@lists.01.org Cc: Jiewen Yao , star.zeng@intel.com References: <20181015063833.61304-1-ruiyu.ni@intel.com> <20181015063833.61304-11-ruiyu.ni@intel.com> From: "Zeng, Star" Message-ID: <34f022ee-96da-fc28-d1fc-48e7b90c1a88@intel.com> Date: Tue, 16 Oct 2018 13:11:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181015063833.61304-11-ruiyu.ni@intel.com> Subject: Re: [PATCH 10/11] MdeModulePkg/UsbBus: Deny when the string descriptor length is odd X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 05:11:33 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 2018/10/15 14:38, Ruiyu Ni wrote: > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Jiewen Yao > Cc: Star Zeng > --- > MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c > index d9bc1f9e28..182a3f97c9 100644 > --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c > +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c > @@ -650,7 +650,7 @@ UsbGetOneString ( > // > Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_STRING, Index, LangId, &Desc, 2); > > - if (EFI_ERROR (Status)) { > + if (EFI_ERROR (Status) || (Desc.Length % 2 != 0)) { Ray, Thanks for the patch. Does the code need check (Desc.Length < 2) first as Desc.Length may be 0 or 1, right? Thanks, Star > return NULL; > } > >