You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/22 05:20:21 UTC
[incubator-nuttx-apps] branch master updated: fix issue with reading ipv6 routes. Handle space ahead of first line of route.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new fd22b6372 fix issue with reading ipv6 routes. Handle space ahead of first line of route.
fd22b6372 is described below
commit fd22b6372255e642617d9d95275df240e8d31fea
Author: mlondono74 <43...@users.noreply.github.com>
AuthorDate: Thu Nov 17 15:34:08 2022 -0500
fix issue with reading ipv6 routes. Handle space ahead of first line of route.
---
netutils/netlib/netlib_ipv6route.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/netutils/netlib/netlib_ipv6route.c b/netutils/netlib/netlib_ipv6route.c
index 59858b661..c35e26f4a 100644
--- a/netutils/netlib/netlib_ipv6route.c
+++ b/netutils/netlib/netlib_ipv6route.c
@@ -28,7 +28,7 @@
#include <string.h>
#include <assert.h>
#include <errno.h>
-
+#include <ctype.h>
#include <arpa/inet.h>
#include "netutils/netlib.h"
@@ -110,6 +110,7 @@ ssize_t netlib_read_ipv6route(FILE *stream,
char line[PROCFS_LINELEN];
FAR char *addr;
int ret;
+ int idx = 0;
DEBUGASSERT(stream != NULL && route != NULL);
@@ -131,9 +132,14 @@ ssize_t netlib_read_ipv6route(FILE *stream,
return 0;
}
- /* The first line of the group should consist of a number index */
+ /* First non-space char of 1st line should be a number index */
+
+ while (isspace(line[idx]))
+ {
+ idx++;
+ }
- if (line[0] < '0' || line[0] > 9)
+ if (line[idx] < '0' || line[idx] > '9')
{
return -EINVAL;
}