diff options
author | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-25 03:29:59 +0000 |
---|---|---|
committer | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-25 03:29:59 +0000 |
commit | 9b6f044a327dabb0a8cd3a38e8c0249fefbcc8af (patch) | |
tree | 2c387c50d730798d939510c52e1f3e6308de8d25 | |
parent | 6e19836f223add173ee5bd82339b4c243869e9b9 (diff) | |
download | edk2-platforms-9b6f044a327dabb0a8cd3a38e8c0249fefbcc8af.tar.xz |
Update according to two review comments:
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
-rw-r--r-- | MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 9ab7ab07c0..d89ac6483d 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -2458,6 +2458,10 @@ NetLibAsciiStrToIp4 ( }
}
+ //
+ // Convert the string to IPv4 address. AsciiStrDecimalToUintn stops at the
+ // first character that is not a valid decimal character, '.' or '\0' here.
+ //
NodeVal = AsciiStrDecimalToUintn (TempStr);
if (NodeVal > 0xFF) {
return EFI_INVALID_PARAMETER;
@@ -2525,7 +2529,7 @@ NetLibAsciiStrToIp6 ( Short = FALSE;
Update = FALSE;
- for (Index = 0; (Index + 1) < 16; Index = (UINT8) (Index + 2)) {
+ for (Index = 0; Index < 15; Index = (UINT8) (Index + 2)) {
TempStr = Ip6Str;
while ((*Ip6Str != '\0') && (*Ip6Str != ':')) {
@@ -2587,7 +2591,8 @@ NetLibAsciiStrToIp6 ( }
//
- // Convert the Str to IPv6 address.
+ // Convert the string to IPv6 address. AsciiStrHexToUintn stops at the first
+ // character that is not a valid hexadecimal character, ':' or '\0' here.
//
NodeVal = AsciiStrHexToUintn (TempStr);
if ((NodeVal > 0xFFFF) || (Index > 14)) {
|