Skip to content

Commit

Permalink
Merge pull request #2779 from kaspar030/fix_ipv6_addr_string_max_length
Browse files Browse the repository at this point in the history
sys: net: ipv6: fix max ipv6 address string length
  • Loading branch information
miri64 committed Apr 11, 2015
2 parents 580ae0a + 23074c7 commit d47cd80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sys/include/net/ng_ipv6/addr.h
Expand Up @@ -44,7 +44,7 @@ extern "C" {
* @brief Maximum length of an IPv6 address as string.
*/
#define NG_IPV6_ADDR_MAX_STR_LEN (sizeof("ffff:ffff:ffff:ffff:" \
"ffff:ffff:ffff:ffff"))
"ffff:ffff:255.255.255.255"))

/**
* @brief Data type to represent an IPv6 address.
Expand Down
6 changes: 3 additions & 3 deletions tests/unittests/tests-ipv6_addr/tests-ipv6_addr.c
Expand Up @@ -812,13 +812,13 @@ static void test_ipv6_addr_from_str__success5(void)
static void test_ipv6_addr_from_str__success6(void)
{
ng_ipv6_addr_t a = { {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 192, 168, 0, 1
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 255, 255, 255, 255
}
};
ng_ipv6_addr_t result;

TEST_ASSERT_NOT_NULL(ng_ipv6_addr_from_str(&result, "::ffff:192.168.0.1"));
TEST_ASSERT_NOT_NULL(ng_ipv6_addr_from_str(&result, "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"));
TEST_ASSERT(ng_ipv6_addr_equal(&a, &result));
}

Expand Down

0 comments on commit d47cd80

Please sign in to comment.