mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 18:27:04 +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:
parent
50efadb0ae
commit
43fcd650e5
Notes:
Lennart Poettering
2015-02-12 17:18:22 +01:00
Backport: bugfix
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user