From: Christian Brauner Date: Sun, 27 Sep 2015 08:17:34 +0000 (+0200) Subject: Check return value of snprintf X-Git-Tag: lxc-2.0.0.beta1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=793e387a9fd67c049c72749596dc00a5520d99b6;p=thirdparty%2Flxc.git Check return value of snprintf Signed-off-by: Christian Brauner Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c index 39e289cb2..0eeff5128 100644 --- a/src/lxc/lxc_destroy.c +++ b/src/lxc/lxc_destroy.c @@ -152,6 +152,8 @@ static int do_destroy_with_snapshots(struct lxc_container *c) /* Destroy snapshots created with lxc-clone listed in lxc-snapshots. */ ret = snprintf(path, MAXPATHLEN, "%s/%s/lxc_snapshots", c->config_path, c->name); + if (ret < 0 || ret >= MAXPATHLEN) + return -1; fd = open(path, O_RDONLY | O_CLOEXEC); if (fd >= 0) {