diff mbox

[edk2] MdeModulePkg/PXE: Avoid using overloaded BootFileName or ServerName

Message ID 1461313967-15104-1-git-send-email-heyi.guo@linaro.org
State New
Headers show

Commit Message

gary guo April 22, 2016, 8:32 a.m. UTC
BootFileName or ServerName in DHCP offer may be overloaded and cannot
be used, so we manually set the strings to be null to avoid misusing.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: chenzhihui <chenzhihui4@huawei.com>

Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
---
 MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.7.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

gary guo April 23, 2016, 6:35 a.m. UTC | #1
Sorry, it is not good to modify the original data of the packets. Please 
ignore this patch and I'll send out a new one.

Regards.

Heyi

On 04/22/2016 04:32 PM, Heyi Guo wrote:
> BootFileName or ServerName in DHCP offer may be overloaded and cannot

> be used, so we manually set the strings to be null to avoid misusing.

>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: chenzhihui <chenzhihui4@huawei.com>

> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>

> Cc: Feng Tian <feng.tian@intel.com>

> Cc: Star Zeng <star.zeng@intel.com>

> Cc: Siyuan Fu <siyuan.fu@intel.com>

> Cc: Jiaxin Wu <jiaxin.wu@intel.com>

> ---

>   MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 4 ++++

>   1 file changed, 4 insertions(+)

>

> diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c

> index 6c06373..ecd1903 100644

> --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c

> +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c

> @@ -172,6 +172,8 @@ PxeBcParseCachedDhcpPacket (

>                                );

>           }

>         }

> +      // Terminate the invalid string to avoid misusing

> +      Offer->Dhcp4.Header.BootFileName[0] = 0;

>       }

>       if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_SERVER_NAME) != 0) {

>         for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) {

> @@ -183,6 +185,8 @@ PxeBcParseCachedDhcpPacket (

>                                );

>           }

>         }

> +      // Terminate the invalid string to avoid misusing

> +      Offer->Dhcp4.Header.ServerName[0] = 0;

>       }

>     }

>   


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index 6c06373..ecd1903 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -172,6 +172,8 @@  PxeBcParseCachedDhcpPacket (
                              );
         }
       }
+      // Terminate the invalid string to avoid misusing
+      Offer->Dhcp4.Header.BootFileName[0] = 0;
     }
     if ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_SERVER_NAME) != 0) {
       for (Index = 0; Index < PXEBC_DHCP4_TAG_INDEX_MAX; Index++) {
@@ -183,6 +185,8 @@  PxeBcParseCachedDhcpPacket (
                              );
         }
       }
+      // Terminate the invalid string to avoid misusing
+      Offer->Dhcp4.Header.ServerName[0] = 0;
     }
   }