summaryrefslogtreecommitdiff
path: root/usr.sbin/timed
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-22 00:53:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-01-22 00:53:19 +0000
commit2bd140305e1e16861517150c2af5982a10aa3801 (patch)
treecb8c3a9d4fa6ed504a713623e3f4fb71d5609f49 /usr.sbin/timed
parent5fa75022a76d00617da21e73a1e8674aa4ec280e (diff)
do not accept packets with an unterminated hostname; ben@freebsd
Diffstat (limited to 'usr.sbin/timed')
-rw-r--r--usr.sbin/timed/timed/readmsg.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c
index dc6a729bb3b..868e018ad94 100644
--- a/usr.sbin/timed/timed/readmsg.c
+++ b/usr.sbin/timed/timed/readmsg.c
@@ -36,7 +36,7 @@ static char sccsid[] = "@(#)readmsg.c 5.1 (Berkeley) 5/11/93";
#endif /* not lint */
#ifdef sgi
-#ident "$Revision: 1.2 $"
+#ident "$Revision: 1.3 $"
#endif
#include "globals.h"
@@ -219,6 +219,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) ==