pipewire: rtsp-client: use offsetof()

Use `offsetof()` instead of `sizeof()` to correctly determine the offset
of the flexible array member.
This commit is contained in:
Barnabás Pőcze 2024-09-18 17:07:02 +02:00
parent 11e0492f79
commit 08c7c7999b

View file

@ -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) if ((f = open_memstream((char**)&msg, &len)) == NULL)
return -errno; return -errno;
fseek(f, sizeof(*msg), SEEK_SET); fseek(f, offsetof(struct message, data), SEEK_SET);
cseq = ++client->cseq; cseq = ++client->cseq;
@ -598,7 +598,7 @@ int pw_rtsp_client_url_send(struct pw_rtsp_client *client, const char *url,
fclose(f); fclose(f);
msg->len = len - sizeof(*msg); msg->len = len - offsetof(struct message, data);
msg->offset = 0; msg->offset = 0;
msg->reply = reply; msg->reply = reply;
msg->user_data = user_data; msg->user_data = user_data;