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>
This commit is contained in:
Jiaxin Wu 2017-04-21 10:15:27 +08:00
parent 8ca4176883
commit 17b25f5203
1 changed files with 5 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Interface routine for Mtftp4. Interface routine for Mtftp4.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR> (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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -667,6 +667,10 @@ EfiMtftp4Configure (
Gateway = NTOHL (Gateway); Gateway = NTOHL (Gateway);
ServerIp = NTOHL (ServerIp); ServerIp = NTOHL (ServerIp);
if (ServerIp == 0 || IP4_IS_LOCAL_BROADCAST (ServerIp)) {
return EFI_INVALID_PARAMETER;
}
if (!ConfigData->UseDefaultSetting && if (!ConfigData->UseDefaultSetting &&
((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) { ((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) {