Fix: lttng-ctl: appending to dynamic buffer invalidates its data member
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Feb 2021 23:13:19 +0000 (18:13 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Feb 2021 23:48:45 +0000 (18:48 -0500)
commitb22f4f54e95ae13edda1d4d5efd1e4845a6319c4
treeb59752fb42eca2003d30e1653b799091f8b75848
parentb083f028413002a7d18f2e7b93680e1bb767a259
Fix: lttng-ctl: appending to dynamic buffer invalidates its data member

`lttng_register_trigger` samples the address of the lsm header in the
message payload. However, it does so before calling
`lttng_trigger_serialize()` which may increase the underlying buffer's
size (and cause a realloc()).

Most of the time the message buffer is large enough _or_ its realloc
yields the same address which hid the problem. However, I stumbled on
a case (a trigger which snapshots to a long location) where the realloc
ends-up returning a completely different address, causing invalid data
to be sent to the session daemon.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8e4323dac778bc2a1af7b6e2cca42f6521abaee2
src/lib/lttng-ctl/lttng-ctl.c
This page took 0.025999 seconds and 5 git commands to generate.