mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 06:37:46 +00:00
[ip6] add additional parse validation to Ip6::Address::FromString (#3843)
This commit is contained in:
@@ -316,6 +316,9 @@ otError Address::FromString(const char *aBuf)
|
||||
|
||||
// Do not count bytes of the embedded IPv4 address.
|
||||
endp -= kIp4AddressSize;
|
||||
|
||||
VerifyOrExit(dst <= endp, error = OT_ERROR_PARSE);
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -189,6 +189,13 @@ void TestIp6AddressFromString(void)
|
||||
{0},
|
||||
OT_ERROR_PARSE
|
||||
},
|
||||
|
||||
// Invalid embedded IPv4 address.
|
||||
{
|
||||
":f:0:0:c:0:f:f:.",
|
||||
{0},
|
||||
OT_ERROR_PARSE
|
||||
},
|
||||
};
|
||||
|
||||
for (uint32_t index = 0; index < OT_ARRAY_LENGTH(testVectors); index++)
|
||||
|
||||
Reference in New Issue
Block a user