From 9ed31e53b05b06b4ae63ceb2574a3faaff86685c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 14 Dec 2013 10:44:17 -0500 Subject: [PATCH] Fix: lttng-live non NULL-terminated strings Found by coverity. ** CID 1136986: String not null terminated (STRING_NULL) /formats/lttng-live/lttng-live-functions.c: 375 in lttng_live_attach_session() Signed-off-by: Mathieu Desnoyers --- formats/lttng-live/lttng-live-functions.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/formats/lttng-live/lttng-live-functions.c b/formats/lttng-live/lttng-live-functions.c index 9de53ae5..67c814cf 100644 --- a/formats/lttng-live/lttng-live-functions.c +++ b/formats/lttng-live/lttng-live-functions.c @@ -201,6 +201,8 @@ int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path) goto error; } assert(ret_len == sizeof(lsession)); + lsession.hostname[LTTNG_VIEWER_HOST_NAME_MAX - 1] = '\0'; + lsession.session_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0'; fprintf(stdout, "%s/%" PRIu64 " : %s on host %s (timer = %u, " "%u stream(s), %u client(s) connected)\n", @@ -355,6 +357,8 @@ int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id) goto error; } assert(ret_len == sizeof(stream)); + stream.path_name[LTTNG_VIEWER_PATH_MAX - 1] = '\0'; + stream.channel_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0'; printf_verbose(" stream %" PRIu64 " : %s/%s\n", be64toh(stream.id), stream.path_name, -- 2.34.1