summaryrefslogtreecommitdiffstats
path: root/usr.sbin/timed
diff options
context:
space:
mode:
authorben <ben@FreeBSD.org>2001-01-01 18:43:21 +0000
committerben <ben@FreeBSD.org>2001-01-01 18:43:21 +0000
commitde830bf0bbf3b3aa5914e9cb86402cff26d26363 (patch)
tree8ca21acd90034b0b402dd58518494dd49ba78680 /usr.sbin/timed
parentebe888cdb74415e564b824cf464e654d108e64ae (diff)
downloadFreeBSD-src-de830bf0bbf3b3aa5914e9cb86402cff26d26363.zip
FreeBSD-src-de830bf0bbf3b3aa5914e9cb86402cff26d26363.tar.gz
Check that the hostname field in received packets is NUL-terminated.
Diffstat (limited to 'usr.sbin/timed')
-rw-r--r--usr.sbin/timed/timed/readmsg.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c
index 6638390..cca415e 100644
--- a/usr.sbin/timed/timed/readmsg.c
+++ b/usr.sbin/timed/timed/readmsg.c
@@ -230,6 +230,13 @@ again:
continue;
}
+ if (memchr(msgin.tsp_name,
+ '\0', sizeof msgin.tsp_name) == NULL) {
+ syslog(LOG_NOTICE, "hostname field not NUL terminated "
+ "in packet from %s", inet_ntoa(from.sin_addr));
+ continue;
+ }
+
fromnet = NULL;
for (ntp = nettab; ntp != NULL; ntp = ntp->next)
if ((ntp->mask & from.sin_addr.s_addr) ==
OpenPOWER on IntegriCloud