]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Check return value of snprintf
authorChristian Brauner <christianvanbrauner@gmail.com>
Sun, 27 Sep 2015 08:17:34 +0000 (10:17 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 28 Sep 2015 19:47:18 +0000 (15:47 -0400)
Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc_destroy.c

index 39e289cb215144b9f292c9872cfe61584e5ba0fc..0eeff5128cb7e87972c833b2397957b483cdc92a 100644 (file)
@@ -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) {