From 27773d570b1413e0a393fbd3ff59c1ec1efbd798 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 20 Sep 2017 10:59:00 -0600 Subject: [PATCH] Fix a copy-paste error --- netutils/netlib/netlib_ipv4route.c | 2 ++ netutils/netlib/netlib_ipv6route.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netutils/netlib/netlib_ipv4route.c b/netutils/netlib/netlib_ipv4route.c index 03a14ca22..86fb83e68 100644 --- a/netutils/netlib/netlib_ipv4route.c +++ b/netutils/netlib/netlib_ipv4route.c @@ -84,6 +84,8 @@ static void set_nul_terminator(FAR char *str) { + /* The first non-decimal character that is not '.' terminates the address */ + while ((*str >= '0' && *str <= '9') || *str == '.') { str++; diff --git a/netutils/netlib/netlib_ipv6route.c b/netutils/netlib/netlib_ipv6route.c index af8375fe5..82d7d0ab0 100644 --- a/netutils/netlib/netlib_ipv6route.c +++ b/netutils/netlib/netlib_ipv6route.c @@ -83,7 +83,12 @@ static void set_nul_terminator(FAR char *str) { - while ((*str >= '0' && *str <= '9') || *str == '.') + /* The first non-hex character that is not ':' terminates the address */ + + while ((*str >= '0' && *str <= '9') || + (*str >= 'a' && *str <= 'f') || + (*str >= 'A' && *str <= 'F') || + *str == ':') { str++; }