Skip to content

Commit

Permalink
lxccontainer: use snprintf()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 31, 2017
1 parent 5e78e16 commit 90b366f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lxc/lxccontainer.c
Expand Up @@ -3354,7 +3354,11 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
saved_unexp_conf = NULL;
c->lxc_conf->unexpanded_len = saved_unexp_len;

sprintf(newpath, "%s/%s/rootfs", lxcpath, newname);
ret = snprintf(newpath, MAXPATHLEN, "%s/%s/rootfs", lxcpath, newname);
if (ret < 0 || ret >= MAXPATHLEN) {
SYSERROR("clone: failed making rootfs pathname");
goto out;
}
if (mkdir(newpath, 0755) < 0) {
SYSERROR("error creating %s", newpath);
goto out;
Expand Down

0 comments on commit 90b366f

Please sign in to comment.