From c4a2f9b480259e71621dcc0072b02f701983224e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 6 May 2026 11:27:58 +0200 Subject: [PATCH] rtp-sap: also handle short reads Don't only handle -1 errors from read but also short reads that could leave the buffer with uninitialized data. --- src/modules/module-rtp-sap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/module-rtp-sap.c b/src/modules/module-rtp-sap.c index f4dc321cf..290a34b51 100644 --- a/src/modules/module-rtp-sap.c +++ b/src/modules/module-rtp-sap.c @@ -631,7 +631,7 @@ static bool update_ts_refclk(struct impl *impl) } uint8_t buf[sizeof(struct ptp_management_msg) + sizeof(struct ptp_parent_data_set)]; - if (read(impl->ptp_fd, &buf, sizeof(buf)) == -1) { + if (read(impl->ptp_fd, buf, sizeof(buf)) != (ssize_t)sizeof(buf)) { pw_log_warn("Failed to receive PTP management response: %m"); return false; }