From f4f239b35cbae2a8501b1a082e0fd62d8cd117a6 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 1 Mar 2022 09:50:06 -0500 Subject: [PATCH] Fix: ser/des: missing null terminator on payload append MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/event.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index c3a2c0eb7..6d82504e2 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1145,7 +1145,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) { @@ -1154,7 +1155,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, -- 2.34.1