]> 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>
Mon, 10 Dec 2018 08:18:05 +0000 (09:18 +0100)
Unchecked return value

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

index 4359f7c4acd66fb621767d210404aa3e8c949627..bf79f839b517fd7b2f39cc5142b37569b21f66c3 100644 (file)
@@ -801,6 +801,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;
 
@@ -814,7 +815,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') {