From: Jérémie Galarneau Date: Wed, 16 Mar 2022 15:56:21 +0000 (-0400) Subject: Fix: event: erroneous bound check on perf counter name size X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=97f9ed7d7da933aaf3c25c9a8a7fe12b5b9f8d58 Fix: event: erroneous bound check on perf counter name size The wrong size if used when initializing a perf counter name from a payload. The destination size must be used to prevent out of bound writes. Signed-off-by: Jérémie Galarneau Change-Id: I8ea41d30815bd2c02bb2ad8b01e8cecd2d6549a8 --- diff --git a/src/common/event.cpp b/src/common/event.cpp index 7946d3209..601c6ac1f 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1041,7 +1041,8 @@ static ssize_t lttng_event_context_perf_counter_populate_from_payload( goto end; } - ret = lttng_strncpy(event_ctx->u.perf_counter.name, name, name_len); + ret = lttng_strncpy(event_ctx->u.perf_counter.name, name, + sizeof(event_ctx->u.perf_counter.name)); if (ret) { consumed = -1; goto end;