[CRIU] [PATCH] cgroup: fix dereference before null check
Andrey Vagin
avagin at openvz.org
Wed Aug 6 06:13:00 PDT 2014
Coverity: 1230177 Dereference before null check
There may be a null pointer dereference, or else the comparison against
null is unnecessary. In parse_task_cgroup: All paths that lead to this
null pointer comparison already dereference the pointer earlier
(CWE-476)
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
proc_parse.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/proc_parse.c b/proc_parse.c
index 1c66782..b0333be 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -1538,7 +1538,8 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n)
* 2:name=systemd:/user.slice/user-1000.slice/session-1.scope
*/
name = strchr(buf, ':') + 1;
- path = strchr(name, ':');
+ if (name)
+ path = strchr(name, ':');
if (!name || !path) {
pr_err("Failed parsing cgroup %s\n", buf);
xfree(ncc);
--
1.8.5.3
More information about the CRIU
mailing list