Fix: ser/des: missing null terminator on payload append
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 1 Mar 2022 14:50:06 +0000 (09:50 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 1 Mar 2022 19:15:13 +0000 (14:15 -0500)
Reported by the lttng-ust-java-tests_master_build CI job.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I47b048c65a9855347c9b02fe44d9fdbae7e06dbf

src/common/event.c

index 4ea9ecf1e6b2a88ab075f6b6b45c05383c42a034..304b0fe95570bc830d0f3dc782ba5916b6830370 100644 (file)
@@ -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,
This page took 0.039113 seconds and 4 git commands to generate.