mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
6e19836f22
commit
9b6f044a32
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue