From: Jiaxin Wu Date: Fri, 10 Mar 2017 06:45:12 +0000 (+0800) Subject: MdePkg/UefiDevicePathLib: Fix the wrong MAC address length X-Git-Tag: edk2-stable201903~4399 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2d67f2bae32040c77af8097a8ef1be272cb00e28 MdePkg/UefiDevicePathLib: Fix the wrong MAC address length Network interface type should be checked before the conversion between text device path node and MAC device path. Otherwise, the MAC text string can't be converted to the representation of a device node, which leads to the series failure of network HII configuration(e.g. IP, VLAN, HTTP Boot configuration in Network Device List). Cc: Liming Gao Cc: Ruiyu Ni Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Ruiyu Ni Reviewed-by: Ye Ting Reviewed-by: Fu Siyuan --- diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c index ae38859542..a52cbef48f 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -1800,6 +1800,10 @@ DevPathFromTextMAC ( MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr); Length = sizeof (EFI_MAC_ADDRESS); + if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) { + Length = 6; + } + StrHexToBytes (AddressStr, Length * 2, MACDevPath->MacAddress.Addr, Length); return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;