[Olsr-dev] [PATCH v1 09/18] info: protect skipLeadingWhitespace against invalid input and zero length

Ferry Huberts (spam-protected)
Sat Dec 10 18:25:19 CET 2016


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/olsrd_info.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index 1f431b7..a27ed71 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -580,6 +580,10 @@ static void send_info(const char * req, unsigned int send_what, int the_socket,
 }
 
 static char * skipLeadingWhitespace(char * requ, size_t *len) {
+  if (!requ || !len || !*len) {
+    return requ;
+  }
+
   while (isspace(*requ) && (*requ != '\0')) {
     *len = *len - 1;
     requ++;
-- 
2.9.3




More information about the Olsr-dev mailing list