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 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 830AB81D16 for ; Sun, 30 Oct 2016 19:23:10 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 30 Oct 2016 19:23:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,572,1473145200"; d="scan'208";a="895818601" Received: from sfu5-mobl3.ccr.corp.intel.com ([10.239.192.234]) by orsmga003.jf.intel.com with ESMTP; 30 Oct 2016 19:23:10 -0700 From: Fu Siyuan To: edk2-devel@lists.01.org Cc: Ye Ting , Zhang Lubo , Wu Jiaxin Date: Mon, 31 Oct 2016 10:23:00 +0800 Message-Id: <1477880581-12760-2-git-send-email-siyuan.fu@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> References: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 02:23:10 -0000 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan Cc: Ye Ting Cc: Zhang Lubo Cc: Wu Jiaxin --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 4746256..43568ed 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -2317,6 +2317,14 @@ EfiPxeBcSetStationIP ( if (NewSubnetMask != NULL && !IP4_IS_VALID_NETMASK (NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; } + + if (NewStationIp != NULL) { + if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || + IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || + (NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { + return EFI_INVALID_PARAMETER; + } + } if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; -- 2.7.4.windows.1