From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 00B1C2195406F for ; Thu, 20 Apr 2017 19:21:34 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2017 19:21:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,228,1488873600"; d="scan'208";a="90458489" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.99]) by orsmga005.jf.intel.com with ESMTP; 20 Apr 2017 19:21:33 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Fri, 21 Apr 2017 10:21:27 +0800 Message-Id: <1492741287-12936-2-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1492741287-12936-1-git-send-email-jiaxin.wu@intel.com> References: <1492741287-12936-1-git-send-email-jiaxin.wu@intel.com> Subject: [Patch] MdeModulePkg/Mtftp4Dxe: Add invalid ServerIp check during MTFTP configuration 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: Fri, 21 Apr 2017 02:21:35 -0000 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c index 5494231..54384e1 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c @@ -1,10 +1,10 @@ /** @file Interface routine for Mtftp4. (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
@@ -665,10 +665,14 @@ EfiMtftp4Configure ( Ip = NTOHL (Ip); Netmask = NTOHL (Netmask); Gateway = NTOHL (Gateway); ServerIp = NTOHL (ServerIp); + if (ServerIp == 0 || IP4_IS_LOCAL_BROADCAST (ServerIp)) { + return EFI_INVALID_PARAMETER; + } + if (!ConfigData->UseDefaultSetting && ((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) { return EFI_INVALID_PARAMETER; } -- 1.9.5.msysgit.1