Ensure monitored container name is null terminated

regexec() expects a null terminated name.

Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Michael Santos 2011-03-16 10:05:05 -04:00 committed by Daniel Lezcano
parent 302aaa2b2d
commit f3bc28bd61

View File

@ -70,6 +70,7 @@ void lxc_monitor_send_state(const char *name, lxc_state_t state)
struct lxc_msg msg = { .type = lxc_msg_state,
.value = state };
strncpy(msg.name, name, sizeof(msg.name));
msg.name[sizeof(msg.name) - 1] = 0;
lxc_monitor_send(&msg);
}