Fix: Handle empty string in lttng_event_field_value_string_create_with_size
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Sep 2022 17:36:38 +0000 (13:36 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 30 Sep 2022 19:12:36 +0000 (15:12 -0400)
commit8ce733e56bbab1ca5507b868e8093f4cb5cc87b7
tree15f078803fc579114c5cca214dd3357b689462a0
parentc7a4f82e187f16400a8f1894651c2f92a3592f5b
Fix: Handle empty string in lttng_event_field_value_string_create_with_size

When using the event notification capture API, empty strings are
represented by a NULL pointer with a size=0 in the msgpack object.
The NULL pointer is unexpected, which triggers an assertion in
lttng_event_field_value_string_create_with_size.

Fix this by duplicating an empty string ("") when a size=0 is
encountered. This ensures that users of the API don't end up with an
unexpected NULL pointer. Indeed, the sample program notif-app.c in the
LTTng website documentation does not expect a NULL pointer.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7c3a839dbbeeb95a1b3bf6ddc3205a2f6b4538e3
src/common/event-field-value.c
This page took 0.029749 seconds and 5 git commands to generate.