From 08c7c7999b97c65b65302e4593f03d5b42ea4027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 18 Sep 2024 17:07:02 +0200 Subject: [PATCH] pipewire: rtsp-client: use `offsetof()` Use `offsetof()` instead of `sizeof()` to correctly determine the offset of the flexible array member. --- src/modules/module-raop/rtsp-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/module-raop/rtsp-client.c b/src/modules/module-raop/rtsp-client.c index 952891d9a..fae71977c 100644 --- a/src/modules/module-raop/rtsp-client.c +++ b/src/modules/module-raop/rtsp-client.c @@ -576,7 +576,7 @@ int pw_rtsp_client_url_send(struct pw_rtsp_client *client, const char *url, if ((f = open_memstream((char**)&msg, &len)) == NULL) return -errno; - fseek(f, sizeof(*msg), SEEK_SET); + fseek(f, offsetof(struct message, data), SEEK_SET); cseq = ++client->cseq; @@ -598,7 +598,7 @@ int pw_rtsp_client_url_send(struct pw_rtsp_client *client, const char *url, fclose(f); - msg->len = len - sizeof(*msg); + msg->len = len - offsetof(struct message, data); msg->offset = 0; msg->reply = reply; msg->user_data = user_data;