]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425766
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Jun 2018 20:09:14 +0000 (22:09 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Jun 2018 20:36:45 +0000 (22:36 +0200)
Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/criu.c

index eab650d7e3c972e5d3889be132a76659aa03131a..155e69f8653f5cdc3a0f422d13887bcbeb2518ee 100644 (file)
@@ -900,6 +900,7 @@ static bool criu_ok(struct lxc_container *c, char **criu_version)
 
 static bool restore_net_info(struct lxc_container *c)
 {
+       int ret;
        struct lxc_list *it;
        bool has_error = true;
 
@@ -913,7 +914,9 @@ static bool restore_net_info(struct lxc_container *c)
                if (netdev->type != LXC_NET_VETH)
                        continue;
 
-               snprintf(template, sizeof(template), "vethXXXXXX");
+               ret = snprintf(template, sizeof(template), "vethXXXXXX");
+               if (ret < 0 || ret >= sizeof(template))
+                       goto out_unlock;
 
                if (netdev->priv.veth_attr.pair[0] == '\0' &&
                    netdev->priv.veth_attr.veth1[0] == '\0') {