mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
31 lines
1.2 KiB
Diff
31 lines
1.2 KiB
Diff
From 43fcd650e5cb0836cfc9f667ed74b3bc0283a81c Mon Sep 17 00:00:00 2001
|
|
From: Topi Miettinen <toiwoton@gmail.com>
|
|
Date: Sun, 18 Jan 2015 16:01:25 +0200
|
|
Subject: [PATCH] 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)
|
|
---
|
|
src/timesync/timesyncd-manager.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
|
|
index 117ea8c..bc35662 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);
|
|
}
|
|
--
|
|
2.3.0
|
|
|