]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
refine the code and add more security check.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
index 8d72f585d040a0f9056face6c2022f19dcc737ea..54d317416d6468447653ed5fefdce470c83f73af 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
-Copyright (c) 2009, Intel Corporation.<BR>\r
+Copyright (c) 2009 - 2010, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -238,6 +238,7 @@ VlanCallback (
     //\r
     // Remove VLAN\r
     //\r
+    ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);\r
     for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {\r
       if (Configuration->VlanList[Index] != 0) {\r
         //\r
@@ -421,7 +422,7 @@ InstallVlanConfigForm (
   EFI_STATUS                      Status;\r
   EFI_HII_HANDLE                  HiiHandle;\r
   EFI_HANDLE                      DriverHandle;\r
-  CHAR16                          Str[40];\r
+  CHAR16                          Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];\r
   CHAR16                          *MacString;\r
   EFI_DEVICE_PATH_PROTOCOL        *ChildDevicePath;\r
   EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess;\r
@@ -479,6 +480,7 @@ InstallVlanConfigForm (
   PrivateData->MacString = MacString;\r
 \r
   StrCpy (Str, L"VLAN Configuration (MAC:");\r
+  ASSERT (StrLen (MacString) <= (sizeof (EFI_MAC_ADDRESS) * 2));\r
   StrCat (Str, MacString);\r
   StrCat (Str, L")");\r
   HiiSetString (\r