relayd: clean-up: strncpy uses the length of the source as length
[lttng-tools.git] / src / bin / lttng-relayd / cmd-2-4.c
index f420ad928ee0e4faf36c5c8f49f3df2bff734383..ac6e0425877970f3da91b05911fa8dc0c644609b 100644 (file)
@@ -53,8 +53,7 @@ int cmd_create_session_2_4(const struct lttng_buffer_view *payload,
                ERR("Session name too long");
                goto error;
        }
-       strncpy(session_name, session_info.session_name,
-                       sizeof(session_info.session_name));
+       strncpy(session_name, session_info.session_name, LTTNG_PATH_MAX);
 
        len = lttng_strnlen(session_info.hostname, sizeof(session_info.hostname));
        if (len == sizeof(session_info.hostname) || len >= LTTNG_HOST_NAME_MAX) {
@@ -62,8 +61,7 @@ int cmd_create_session_2_4(const struct lttng_buffer_view *payload,
                ERR("Session name too long");
                goto error;
        }
-       strncpy(hostname, session_info.hostname,
-                       sizeof(session_info.hostname));
+       strncpy(hostname, session_info.hostname, LTTNG_HOST_NAME_MAX);
 
        *live_timer = be32toh(session_info.live_timer);
        *snapshot = be32toh(session_info.snapshot);
This page took 0.023597 seconds and 4 git commands to generate.