From 8560212cbb078b992a5cb3f2fa50bf845442cbc6 Mon Sep 17 00:00:00 2001 From: Ferry Huberts Date: Thu, 8 Dec 2016 08:49:08 +0100 Subject: [PATCH] info: protect stripTrailingSlashes against invalid input and zero length Signed-off-by: Ferry Huberts --- 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 fc1597a3..e956866f 100644 --- a/lib/info/olsrd_info.c +++ b/lib/info/olsrd_info.c @@ -606,6 +606,10 @@ static char * stripEOLs(char * requ, size_t *len) { } static char * stripTrailingSlashes(char * requ, size_t *len) { + if (!requ || !len || !*len) { + return requ; + } + while ((requ[*len - 1] == '/') && (requ[*len - 1] != '\0')) { *len = *len - 1; requ[*len] = '\0'; -- 2.20.1