From 7430771ec340941c11b6f867c0022ad1867e2b24 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Fri, 21 Apr 2017 10:15:27 +0800 Subject: [PATCH] MdeModulePkg/Mtftp4Dxe: Add invalid ServerIp check during MTFTP configuration Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Ye Ting Reviewed-by: Fu Siyuan (cherry picked from commit 17b25f520302f813a50f7876edc2e8fc901e7a7c) --- 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 5494231166..54384e143e 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c @@ -2,7 +2,7 @@ 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 @@ -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))))) {