[Olsr-dev] [PATCH v1 10/18] info: protect skipMultipleSlashes	against invalid input and zero length
    Ferry Huberts 
    (spam-protected)
       
    Sat Dec 10 18:25:20 CET 2016
    
    
  
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/olsrd_info.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index a27ed71..fc1597a 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -101,7 +101,9 @@ static struct info_cache_t info_cache;
 static char * skipMultipleSlashes(char * requ, size_t* len) {
   char * r = requ;
 
-  if ((r[0] == '\0') // zero length
+  if (!r // null pointer
+      || (len && !*len) // zero length
+      || (r[0] == '\0') // zero length
       || (r[0] != '/') // does not start with a slash
       || (r[1] != '/')) // does not have another slash
   {
-- 
2.9.3
    
    
More information about the Olsr-dev
mailing list