diff options
author | ben <ben@FreeBSD.org> | 2001-01-01 18:43:21 +0000 |
---|---|---|
committer | ben <ben@FreeBSD.org> | 2001-01-01 18:43:21 +0000 |
commit | de830bf0bbf3b3aa5914e9cb86402cff26d26363 (patch) | |
tree | 8ca21acd90034b0b402dd58518494dd49ba78680 | |
parent | ebe888cdb74415e564b824cf464e654d108e64ae (diff) | |
download | FreeBSD-src-de830bf0bbf3b3aa5914e9cb86402cff26d26363.zip FreeBSD-src-de830bf0bbf3b3aa5914e9cb86402cff26d26363.tar.gz |
Check that the hostname field in received packets is NUL-terminated.
-rw-r--r-- | usr.sbin/timed/timed/readmsg.c | 7 |
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) == |