summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2001-01-22 00:53:18 +0000
committerderaadt <deraadt@openbsd.org>2001-01-22 00:53:18 +0000
commitcc2cc3aae6f120c245f01797dcf6649ec554b553 (patch)
treeefda95666b7d4461752ee37077bd1f890aeef9cf
parentShuffle man page sections into preferred order. (diff)
downloadwireguard-openbsd-cc2cc3aae6f120c245f01797dcf6649ec554b553.tar.xz
wireguard-openbsd-cc2cc3aae6f120c245f01797dcf6649ec554b553.zip
do not accept packets with an unterminated hostname; ben@freebsd
-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) ==