1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 11:55:23 +03:00

timesyncd: consider too long packets as invalid

If the received NTP message from server didn't fit to our buffer, either
it is doing something nasty or we don't know the protocol. Consider the
packet as invalid.

(David: add parantheses around conditional)
This commit is contained in:
Topi Miettinen 2015-01-18 16:01:25 +02:00 committed by David Herrmann
parent 50efadb0ae
commit 43fcd650e5

View File

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