trace: use snprintf() to ensure g_shm_name is terminated
Change-Id: Id74a1a4de170fae1d4c10c3c0bffb2eba010c3cc Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
3403d59522
commit
e4dc6bbecb
@ -163,7 +163,7 @@ spdk_trace_init(const char *shm_name)
|
|||||||
int trace_fd;
|
int trace_fd;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
strncpy(g_shm_name, shm_name, sizeof(g_shm_name));
|
snprintf(g_shm_name, sizeof(g_shm_name), "%s", shm_name);
|
||||||
|
|
||||||
trace_fd = shm_open(shm_name, O_RDWR | O_CREAT, 0600);
|
trace_fd = shm_open(shm_name, O_RDWR | O_CREAT, 0600);
|
||||||
if (trace_fd == -1) {
|
if (trace_fd == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user