From: Ruben Kerkhof Date: Fri, 4 Dec 2015 20:18:27 +0000 (+0100) Subject: utils_mount.c: check for null before dereferencing X-Git-Tag: collectd-5.5.1~31^2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=27a47fc62d90a115d7a00753a06ffab71e92f487;p=collectd.git utils_mount.c: check for null before dereferencing CID #38025 Signed-off-by: Florian Forster --- diff --git a/src/utils_mount.c b/src/utils_mount.c index 6e6644f4..7b4c9276 100644 --- a/src/utils_mount.c +++ b/src/utils_mount.c @@ -762,13 +762,13 @@ void cu_mount_freelist (cu_mount_t *list) char * cu_mount_checkoption(char *line, char *keyword, int full) { - char *line2, *l2; - int l = strlen(keyword); - char *p1, *p2; + char *line2, *l2, *p1, *p2; + int l; if(line == NULL || keyword == NULL) { return NULL; } + if(full != 0) { full = 1; } @@ -782,6 +782,7 @@ cu_mount_checkoption(char *line, char *keyword, int full) l2++; } + l = strlen(keyword); p1 = line - 1; p2 = strchr(line, ','); do {