summaryrefslogtreecommitdiff
path: root/Core
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2017-04-21 10:15:27 +0800
committerGuo Mang <mang.guo@intel.com>2017-07-12 11:24:24 +0800
commit5a639cd2de3131cfe83b79c6e58d0945844d20a6 (patch)
treec91df68a867f7fcb3e913be2ac8c732d64619b8c /Core
parent30123ad259cd00e4e3fec655af8bd36b37c7196e (diff)
downloadedk2-platforms-5a639cd2de3131cfe83b79c6e58d0945844d20a6.tar.xz
MdeModulePkg/Mtftp4Dxe: Add invalid ServerIp check during MTFTP configuration
Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> (cherry picked from commit 17b25f520302f813a50f7876edc2e8fc901e7a7c)
Diffstat (limited to 'Core')
-rw-r--r--Core/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Core/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c b/Core/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index 5494231166..54384e143e 100644
--- a/Core/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/Core/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -2,7 +2,7 @@
Interface routine for Mtftp4.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
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
@@ -667,6 +667,10 @@ EfiMtftp4Configure (
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))))) {