projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: event: unchecked return value for lttng_strncpy
[lttng-tools.git]
/
src
/
common
/
event.cpp
diff --git
a/src/common/event.cpp
b/src/common/event.cpp
index 6dca04def6e082527338da51694af1605546787a..8e1b99ff902fb5dd91989840ade2ffc483afc170 100644
(file)
--- a/
src/common/event.cpp
+++ b/
src/common/event.cpp
@@
-997,7
+997,8
@@
static ssize_t lttng_event_context_perf_counter_populate_from_payload(
const struct lttng_payload_view *view,
struct lttng_event_context *event_ctx)
{
const struct lttng_payload_view *view,
struct lttng_event_context *event_ctx)
{
- ssize_t ret, offset = 0;
+ int ret;
+ ssize_t consumed, offset = 0;
const struct lttng_event_context_perf_counter_comm *comm;
size_t name_len;
const struct lttng_buffer_view comm_view = lttng_buffer_view_from_view(
const struct lttng_event_context_perf_counter_comm *comm;
size_t name_len;
const struct lttng_buffer_view comm_view = lttng_buffer_view_from_view(
@@
-1009,7
+1010,7
@@
static ssize_t lttng_event_context_perf_counter_populate_from_payload(
event_ctx->ctx == LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER);
if (!lttng_buffer_view_is_valid(&comm_view)) {
event_ctx->ctx == LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER);
if (!lttng_buffer_view_is_valid(&comm_view)) {
-
ret
= -1;
+
consumed
= -1;
goto end;
}
goto end;
}
@@
-1026,7
+1027,7
@@
static ssize_t lttng_event_context_perf_counter_populate_from_payload(
name_len);
if (!lttng_buffer_view_is_valid(&provider_name_view)) {
name_len);
if (!lttng_buffer_view_is_valid(&provider_name_view)) {
-
ret
= -1;
+
consumed
= -1;
goto end;
}
goto end;
}
@@
-1034,21
+1035,25
@@
static ssize_t lttng_event_context_perf_counter_populate_from_payload(
if (!lttng_buffer_view_contains_string(
&provider_name_view, name, name_len)) {
if (!lttng_buffer_view_contains_string(
&provider_name_view, name, name_len)) {
-
ret
= -1;
+
consumed
= -1;
goto end;
}
goto end;
}
- lttng_strncpy(event_ctx->u.perf_counter.name, name, name_len);
+ ret = lttng_strncpy(event_ctx->u.perf_counter.name, name, name_len);
+ if (ret) {
+ consumed = -1;
+ goto end;
+ }
offset += name_len;
}
event_ctx->u.perf_counter.config = comm->config;
event_ctx->u.perf_counter.type = comm->type;
offset += name_len;
}
event_ctx->u.perf_counter.config = comm->config;
event_ctx->u.perf_counter.type = comm->type;
-
ret
= offset;
+
consumed
= offset;
end:
end:
- return
ret
;
+ return
consumed
;
}
ssize_t lttng_event_context_create_from_payload(
}
ssize_t lttng_event_context_create_from_payload(
This page took
0.025019 seconds
and
4
git commands to generate.