diff --git a/app/iscsi_top/iscsi_top.cpp b/app/iscsi_top/iscsi_top.cpp index 58acf63a0..eaab265f9 100644 --- a/app/iscsi_top/iscsi_top.cpp +++ b/app/iscsi_top/iscsi_top.cpp @@ -90,7 +90,7 @@ print_connections(void) int fd, i; char shm_name[64]; - sprintf(shm_name, "spdk_iscsi_conns.%d", g_shm_id); + snprintf(shm_name, sizeof(shm_name), "spdk_iscsi_conns.%d", g_shm_id); fd = shm_open(shm_name, O_RDONLY, 0600); if (fd < 0) { fprintf(stderr, "Cannot open shared memory: %s\n", shm_name); @@ -158,7 +158,7 @@ int main(int argc, char **argv) } } - sprintf(spdk_trace_shm_name, "/iscsi_trace.%d", g_shm_id); + snprintf(spdk_trace_shm_name, sizeof(spdk_trace_shm_name), "/iscsi_trace.%d", g_shm_id); history_fd = shm_open(spdk_trace_shm_name, O_RDONLY, 0600); if (history_fd < 0) { fprintf(stderr, "Unable to open history shm %s\n", spdk_trace_shm_name);