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.
This commit is contained in:
Wim Taymans 2026-05-06 11:27:58 +02:00
parent ca46444d13
commit c4a2f9b480

View file

@ -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;
}