[lxc-devel] [lxc/master] utils: lxc_deslashify() prevent fallthrough
brauner on Github
lxc-bot at linuxcontainers.org
Mon Sep 26 20:07:58 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 457 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160926/7301fcf7/attachment.bin>
-------------- next part --------------
From bf745ce3c088e6797f16c5c64457030adb7783b4 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at canonical.com>
Date: Mon, 26 Sep 2016 22:05:54 +0200
Subject: [PATCH] utils: lxc_deslashify() prevent fallthrough
lxc_string_join() should not be reached when !*path, otherwise we'll risk a
segfault.
Signed-off-by: Christian Brauner <christian.brauner at canonical.com>
---
src/lxc/utils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index ebf3ad9..03c5a8f 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -738,8 +738,9 @@ bool lxc_deslashify(char **path)
return false;
free(*path);
*path = p;
- return true;
}
+ /* Assume that the path we were passed was already clean. */
+ return true;
}
p = lxc_string_join("/", (const char **)parts, **path == '/');
More information about the lxc-devel
mailing list