From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 DA1F88034C for ; Thu, 16 Mar 2017 00:08:50 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 16 Mar 2017 00:08:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="61053229" Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.23]) by orsmga002.jf.intel.com with ESMTP; 16 Mar 2017 00:08:49 -0700 From: Zhang Lubo To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Thu, 16 Mar 2017 15:08:47 +0800 Message-Id: <1489648127-6200-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] MdeModulePkg: Fix bug in DxeHttplib when converting port number. 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: Thu, 16 Mar 2017 07:08:51 -0000 Http boot on X64 platform is faild, this is caused by the incorrect type conversion when getting port number from Url. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin --- MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c index ccc20cc..2ff04ff 100644 --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c @@ -690,10 +690,11 @@ HttpUrlGetPort ( OUT UINT16 *Port ) { CHAR8 *PortString; EFI_STATUS Status; + UINTN Data; UINT32 ResultLength; HTTP_URL_PARSER *Parser; if (Url == NULL || UrlParser == NULL || Port == NULL) { return EFI_INVALID_PARAMETER; @@ -720,11 +721,14 @@ HttpUrlGetPort ( return Status; } PortString[ResultLength] = '\0'; - return AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, (UINTN *) Port); + Status = AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data); + + *Port = (UINT16) Data; + return Status; } /** Get the Path from a HTTP URL. -- 1.9.5.msysgit.1