X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fcommon%2Fevent.c;h=531c73b9f1b09a312929d118ff9b4b57a269ed4b;hb=b7238f7cfdcc67f4c254c03004989156c13c4c15;hp=56af0caaa063979148b85bd967be689ac7fd4871;hpb=38128370a845ede158a9e8793f6836cb220240af;p=lttng-tools.git diff --git a/src/common/event.c b/src/common/event.c index 56af0caaa..531c73b9f 100644 --- a/src/common/event.c +++ b/src/common/event.c @@ -1093,7 +1093,8 @@ static ssize_t lttng_event_context_perf_counter_populate_from_buffer( 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; @@ -1525,6 +1526,9 @@ static enum lttng_error_code compute_flattened_size( /* The basic struct lttng_event */ storage_req = event_count * sizeof(struct lttng_event); + /* The struct lttng_event_extended */ + storage_req += event_count * sizeof(struct lttng_event_extended); + for (i = 0; i < event_count; i++) { int probe_storage_req = 0; const struct event_list_element *element = @@ -1545,10 +1549,6 @@ static enum lttng_error_code compute_flattened_size( probe_storage_req = ret; } - /* The struct·lttng_event_extended */ - storage_req += event_count * - sizeof(struct lttng_event_extended); - if (element->filter_expression) { storage_req += strlen(element->filter_expression) + 1; }