radv/rra: Use memcpy for chunk descriptions

The identifier is not null terminated. "HistoryTokensRaw" does not fit
otherwise.

Reviewed-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25548>
This commit is contained in:
Konstantin Seurer
2023-09-30 21:36:29 +02:00
parent 71c363acc3
commit dc813288c3

View File

@@ -100,7 +100,7 @@ rra_dump_chunk_description(uint64_t offset, uint64_t header_size, uint64_t data_
.data_offset = offset + header_size, .data_offset = offset + header_size,
.data_size = data_size, .data_size = data_size,
}; };
strncpy(chunk.name, name, sizeof(chunk.name) - 1); memcpy(chunk.name, name, strnlen(name, sizeof(chunk.name)));
fwrite(&chunk, sizeof(struct rra_file_chunk_description), 1, output); fwrite(&chunk, sizeof(struct rra_file_chunk_description), 1, output);
} }