From 2e8b4ddb5ab421b6e81fab38aba753e56453843b Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Tue, 3 Jun 2014 13:16:03 -0500 Subject: [PATCH] lxcapi_snapshot: check that c is defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit before using it, like the other snapshot api methods do. This will need to go into stable-1.0 as well. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- src/lxc/lxccontainer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index eb3366b6f..62e38d7a2 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -2859,6 +2859,9 @@ static int lxcapi_snapshot(struct lxc_container *c, const char *commentfile) struct lxc_container *c2; char snappath[MAXPATHLEN], newname[20]; + if (!c || !lxcapi_is_defined(c)) + return -1; + // /var/lib/lxc -> /var/lib/lxcsnaps \0 ret = snprintf(snappath, MAXPATHLEN, "%ssnaps/%s", c->config_path, c->name); if (ret < 0 || ret >= MAXPATHLEN) -- 2.47.2