From: Christian Brauner Date: Thu, 14 Jun 2018 20:09:14 +0000 (+0200) Subject: coverity: #1425766 X-Git-Tag: lxc-3.1.0~247^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7eab8fc6230b4ab7a7dd0305c63a8ff143a193a9;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 eab650d7e..155e69f86 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -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') {