]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update according to two review comments:
authortye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Jan 2010 03:29:59 +0000 (03:29 +0000)
committertye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Jan 2010 03:29:59 +0000 (03:29 +0000)
1. add some comments to clarify AsciiStrDecimalToUintn() can help filtering un-decimal characters.

2. change the condition judgment to “Index < 15” rather than (Index + 1 ) <16.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9803 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeNetLib/DxeNetLib.c

index 9ab7ab07c082a4e02362f64842793075db21dfb0..d89ac6483dbbbda60c7d3590ddfb1bb3cf8818e5 100644 (file)
@@ -2458,6 +2458,10 @@ NetLibAsciiStrToIp4 (
       }\r
     }\r
 \r
+    //\r
+    // Convert the string to IPv4 address. AsciiStrDecimalToUintn stops at the\r
+    // first character that is not a valid decimal character, '.' or '\0' here. \r
+    //\r
     NodeVal = AsciiStrDecimalToUintn (TempStr);\r
     if (NodeVal > 0xFF) {\r
       return EFI_INVALID_PARAMETER;\r
@@ -2525,7 +2529,7 @@ NetLibAsciiStrToIp6 (
   Short       = FALSE;\r
   Update      = FALSE;\r
 \r
-  for (Index = 0; (Index + 1) < 16; Index = (UINT8) (Index + 2)) {\r
+  for (Index = 0; Index < 15; Index = (UINT8) (Index + 2)) {\r
     TempStr = Ip6Str;\r
 \r
     while ((*Ip6Str != '\0') && (*Ip6Str != ':')) {\r
@@ -2587,7 +2591,8 @@ NetLibAsciiStrToIp6 (
     }    \r
 \r
     //\r
-    // Convert the Str to IPv6 address.\r
+    // Convert the string to IPv6 address. AsciiStrHexToUintn stops at the first\r
+    // character that is not a valid hexadecimal character, ':' or '\0' here. \r
     //\r
     NodeVal = AsciiStrHexToUintn (TempStr);\r
     if ((NodeVal > 0xFFFF) || (Index > 14)) {\r