ntp: ignore truncated messages
Don't waste time with processing messages that don't fit in the receive buffer as they most likely wouldn't pass the format check due to an invalid length of an extension field.
This commit is contained in:
parent
5b2caf48dc
commit
8823e2b064
1 changed files with 6 additions and 0 deletions
6
ntp_io.c
6
ntp_io.c
|
@ -598,6 +598,12 @@ process_message(struct msghdr *hdr, int length, int sock_fd)
|
|||
local_addr.sock_fd = sock_fd;
|
||||
if_index = -1;
|
||||
|
||||
if (hdr->msg_flags & MSG_TRUNC) {
|
||||
DEBUG_LOG(LOGF_NtpIO, "Received truncated message from %s:%d",
|
||||
UTI_IPToString(&remote_addr.ip_addr), remote_addr.port);
|
||||
return;
|
||||
}
|
||||
|
||||
for (cmsg = CMSG_FIRSTHDR(hdr); cmsg; cmsg = CMSG_NXTHDR(hdr, cmsg)) {
|
||||
#ifdef HAVE_IN_PKTINFO
|
||||
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
|
||||
|
|
Loading…
Reference in a new issue