Fix: relayd protocol field present from minor 8 is not checked
[lttng-tools.git] / src / bin / lttng-relayd / main.c
index 44ea6cdeee8cd06baf8e0127032de7fc0b4aed03..a312873808d09448bedae6ab9e87344ef0905f5c 100644 (file)
@@ -1808,7 +1808,7 @@ static int relay_recv_metadata(const struct lttcomm_relayd_hdr *recv_hdr,
 
        size_ret = write_padding_to_file(metadata_stream->stream_fd->fd,
                        metadata_payload_header.padding_size);
-       if (size_ret < 0) {
+       if (size_ret < (int64_t) metadata_payload_header.padding_size) {
                ret = -1;
                goto end_put;
        }
@@ -2242,8 +2242,12 @@ static int relay_recv_index(const struct lttcomm_relayd_hdr *recv_hdr,
        index_info.timestamp_end = be64toh(index_info.timestamp_end);
        index_info.events_discarded = be64toh(index_info.events_discarded);
        index_info.stream_id = be64toh(index_info.stream_id);
-       index_info.stream_instance_id = be64toh(index_info.stream_instance_id);
-       index_info.packet_seq_num = be64toh(index_info.packet_seq_num);
+
+       if (conn->minor >= 8) {
+               index_info.stream_instance_id =
+                               be64toh(index_info.stream_instance_id);
+               index_info.packet_seq_num = be64toh(index_info.packet_seq_num);
+       }
 
        stream = stream_get_by_id(index_info.relay_stream_id);
        if (!stream) {
@@ -3068,8 +3072,7 @@ static int relay_process_control_receive_header(struct relay_connection *conn)
                        conn->sock->fd, header.cmd, header.cmd_version,
                        header.data_size);
 
-       /* FIXME temporary arbitrary limit on data size. */
-       if (header.data_size > (128 * 1024 * 1024)) {
+       if (header.data_size > DEFAULT_NETWORK_RELAYD_CTRL_MAX_PAYLOAD_SIZE) {
                ERR("Command header indicates a payload (%" PRIu64 " bytes) that exceeds the maximal payload size allowed on a control connection.",
                                header.data_size);
                ret = -1;
This page took 0.024315 seconds and 4 git commands to generate.