[Olsr-dev] [PATCH v1 08/18] info: protect stripEOLs against invalid input and zero length
Ferry Huberts
(spam-protected)
Sat Dec 10 18:25:18 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 43170b8..1f431b7 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -588,6 +588,10 @@ static char * skipLeadingWhitespace(char * requ, size_t *len) {
}
static char * stripEOLs(char * requ, size_t *len) {
+ if (!requ || !len || !*len) {
+ return requ;
+ }
+
while (isspace(requ[*len - 1]) && (requ[*len - 1] != '\0')) {
*len = *len - 1;
requ[*len] = '\0';
--
2.9.3
More information about the Olsr-dev
mailing list