From: Frantisek Sumsal Date: Thu, 16 Apr 2026 09:13:27 +0000 (+0200) Subject: timesync: verify the actual size of the received data X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=335cc8f39c75c2b7cdab8c52fe4c378929556f7e;p=thirdparty%2Fsystemd.git timesync: verify the actual size of the received data iov.iov_len doesn't change after calling recvmsg() so it remains set to sizeof(ntpmsg), which makes the check for a short packet always false. Let's fix that by checking the actual size of the received data instead. --- diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c index 79a9a629c14..e4f471e2aa5 100644 --- a/src/timesync/timesyncd-manager.c +++ b/src/timesync/timesyncd-manager.c @@ -437,7 +437,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re } /* Too short packet? */ - if (iov.iov_len < sizeof(struct ntp_msg)) { + if ((size_t) len < sizeof(struct ntp_msg)) { log_warning("Invalid response from server. Disconnecting."); return manager_connect(m); }