From: Christian Brauner Date: Thu, 14 Jun 2018 20:09:14 +0000 (+0200) Subject: coverity: #1425766 X-Git-Tag: lxc-2.0.10~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=124b0dc73ed8ecbdc1c951b65ecd03f31dfc0002;p=thirdparty%2Flxc.git coverity: #1425766 Unchecked return value Signed-off-by: Christian Brauner --- diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 4359f7c4a..bf79f839b 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -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') {