Fix: event: erroneous bound check on perf counter name size
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 16 Mar 2022 15:56:21 +0000 (11:56 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 17 Mar 2022 17:25:22 +0000 (13:25 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I8ea41d30815bd2c02bb2ad8b01e8cecd2d6549a8

src/common/event.c

index f336875aef9f9306a9ecca742486d8b9ed3bd587..484fde26f28f4beb50ea789debf93ed83e572163 100644 (file)
@@ -1040,7 +1040,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;
This page took 0.027088 seconds and 5 git commands to generate.