Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/IPAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ bool IPAddress::fromString6(const char *address) {
// :: allowed once
return false;
}
if (*address != '\0' && *(address + 1) == ':') {
if (*(address + 1) == ':') {
// ::: not allowed
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions test/src/IPAddress/test_fromString6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,13 @@ TEST_CASE ("Extract invalid IPv6 address", "[IPAddress-fromString-12]")
arduino::IPAddress ip;

REQUIRE(ip.fromString(":::") == false); // three colons by self
REQUIRE(ip.fromString("::::") == false); // four colons by self
REQUIRE(ip.fromString("::3:4:5:6::") == false); // two compressions
REQUIRE(ip.fromString("2001:db8:102:10304:506:708:90a:b0c") == false); // 5 character field
REQUIRE(ip.fromString("200x:db8:102:304:506:708:90a:b0c") == false); // invalid character
REQUIRE(ip.fromString("2001:db8:102:304::506:708:90a:b0c") == false); // double colon with 8 other fields (so not a compression)
REQUIRE(ip.fromString("2001:db8:102:304:::708:90a:b0c") == false); // three colons in middle
REQUIRE(ip.fromString("2001:db8:102:304::::708:90a:b0c") == false); // four colons in middle
REQUIRE(ip.fromString("2001:db8:102:304:506:708:90a:b0c:d0e") == false); // 9 fields
REQUIRE(ip.fromString("2001:db8:102:304:506:708:90a:") == false); // missing last group (but has a colon)
REQUIRE(ip.fromString("2001:db8:102:304:506:708:90a") == false); // only seven groups
Expand Down
Loading