X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftimesync%2Ftimesyncd-manager.c;h=bc35662481fb5d4b958cc929666c72a3e71ca5f9;hp=117ea8c98d83c495edb043e566951a5a7f25603f;hb=43fcd650e5cb0836cfc9f667ed74b3bc0283a81c;hpb=50efadb0ae7bcb4fc5ce5e41163c697501ca1d50 diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c index 117ea8c98..bc3566248 100644 --- a/src/timesync/timesyncd-manager.c +++ b/src/timesync/timesyncd-manager.c @@ -525,7 +525,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re return manager_connect(m); } - if (iov.iov_len < sizeof(struct ntp_msg)) { + /* Too short or too long packet? */ + if (iov.iov_len < sizeof(struct ntp_msg) || (msghdr.msg_flags & MSG_TRUNC)) { log_warning("Invalid response from server. Disconnecting."); return manager_connect(m); }