From 7f23e028113f1fd285a6ef6cd53310ed6164a87c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 19 Mar 2019 15:37:28 -0400 Subject: [PATCH] Fix: lttng_uri structure must be packed as it is used for IPC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The lttng_create_session commands send lttng_uri structures over a UNIX socket. As such, the structure must be packed to preclude the inclusion of any padding. Moreover, the 'in_port_t' is replaced by uint16_t and PATH_MAX is replaced by LTTNG_PATH_MAX to prevent conflicts if both ends of the IPC are not build with the same toolchain/definitions. Signed-off-by: Jérémie Galarneau --- src/common/uri.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/uri.h b/src/common/uri.h index 3ef6669e6..17b041918 100644 --- a/src/common/uri.h +++ b/src/common/uri.h @@ -20,6 +20,7 @@ #include #include +#include /* Destination type of lttng URI */ enum lttng_dst_type { @@ -65,14 +66,14 @@ struct lttng_uri { enum lttng_uri_type utype; enum lttng_stream_type stype; enum lttng_proto_type proto; - in_port_t port; - char subdir[PATH_MAX]; + uint16_t port; + char subdir[LTTNG_PATH_MAX]; union { char ipv4[INET_ADDRSTRLEN]; char ipv6[INET6_ADDRSTRLEN]; - char path[PATH_MAX]; + char path[LTTNG_PATH_MAX]; } dst; -}; +} LTTNG_PACKED; int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2); void uri_free(struct lttng_uri *uri); -- 2.34.1