From: Jonathan Rajotte Date: Tue, 1 Mar 2022 14:50:06 +0000 (-0500) Subject: Fix: ser/des: missing null terminator on payload append X-Git-Tag: v2.13.5~36 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=aca0a945595775a0c6d953662a6f292992d962e8;p=lttng-tools.git Fix: ser/des: missing null terminator on payload append Reported by the lttng-ust-java-tests_master_build CI job. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: I47b048c65a9855347c9b02fe44d9fdbae7e06dbf --- diff --git a/src/common/event.c b/src/common/event.c index 4ea9ecf1e..304b0fe95 100644 --- a/src/common/event.c +++ b/src/common/event.c @@ -1146,7 +1146,8 @@ static int lttng_event_context_app_serialize( } /* Include the null terminator. */ - comm.provider_name_len = provider_len + 1; + provider_len += 1; + comm.provider_name_len = provider_len; ctx_len = strlen(ctx_name); if (ctx_len == 0) { @@ -1155,7 +1156,8 @@ static int lttng_event_context_app_serialize( } /* Include the null terminator. */ - comm.ctx_name_len = ctx_len + 1; + ctx_len += 1; + comm.ctx_name_len = ctx_len; /* Header */ ret = lttng_dynamic_buffer_append(&payload->buffer, &comm,