Fix: ser/des: missing null terminator on payload append
[lttng-tools.git] / src / common / event.cpp
index c3a2c0eb7203566924b0240559f3fe4bbc46a272..6d82504e2fe71611be5c86a1aea8b03cbb301c4a 100644 (file)
@@ -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,
This page took 0.025128 seconds and 4 git commands to generate.