Commit f28b1f68 by Tycho Andersen Committed by Stéphane Graber

c/r: use snprintf to compute device name

This will never actually overflow, because %d is 32 bits and eth is 128 bytes long, but safety first :) Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
parent 4d411134
......@@ -443,8 +443,11 @@ static void exec_criu(struct criu_opts *opts)
if (strlen(n->name) >= sizeof(eth))
goto err;
strncpy(eth, n->name, sizeof(eth));
} else
sprintf(eth, "eth%d", netnr);
} else {
ret = snprintf(eth, sizeof(eth), "eth%d", netnr);
if (ret < 0 || ret >= sizeof(eth))
goto err;
}
switch (n->type) {
case LXC_NET_VETH:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment