Date: Sun, 19 Aug 2001 02:21:44 -0700 From: Kris Kennaway <kris@obsecurity.org> To: Kris Kennaway <kris@obsecurity.org> Cc: freebsd-bugs@FreeBSD.org Subject: Re: misc/29867: 4.3 timed master can't sync Red Hat Linux 6.0 box Message-ID: <20010819022144.A74424@xor.obsecurity.org> In-Reply-To: <200108190920.f7J9K1E43753@freefall.freebsd.org>; from kris@obsecurity.org on Sun, Aug 19, 2001 at 02:20:01AM -0700 References: <200108190920.f7J9K1E43753@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
GNATS screwed up the MIME. Here's the patch again, hopefully unmunged
this time.
Kris
Index: timed/readmsg.c
===================================================================
RCS file: /mnt/ncvs/src/usr.sbin/timed/timed/readmsg.c,v
retrieving revision 1.7
diff -u -r1.7 readmsg.c
--- timed/readmsg.c 2001/01/01 18:43:21 1.7
+++ timed/readmsg.c 2001/08/19 09:14:07
@@ -212,10 +212,15 @@
syslog(LOG_ERR, "recvfrom: %m");
exit(1);
}
- if (n < (ssize_t)sizeof(struct tsp)) {
+ /*
+ * The 4.3BSD protocol spec had a 32-byte tsp_name field, and
+ * this is still OS-dependent. Demand that the packet is at
+ * least long enough to hold a 4.3BSD packet.
+ */
+ if (n < (ssize_t)(sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) {
syslog(LOG_NOTICE,
"short packet (%u/%u bytes) from %s",
- n, sizeof(struct tsp),
+ n, sizeof(struct tsp) - MAXHOSTNAMELEN + 32,
inet_ntoa(from.sin_addr));
continue;
}
Index: timedc/cmds.c
===================================================================
RCS file: /mnt/ncvs/src/usr.sbin/timed/timedc/cmds.c,v
retrieving revision 1.7
diff -u -r1.7 cmds.c
--- timedc/cmds.c 2001/05/09 08:37:18 1.7
+++ timedc/cmds.c 2001/08/19 09:17:16
@@ -332,10 +332,15 @@
warn("recvfrom");
continue;
}
- if (cc < sizeof(struct tsp)) {
+ /*
+ * The 4.3BSD protocol spec had a 32-byte tsp_name field, and
+ * this is still OS-dependent. Demand that the packet is at
+ * least long enough to hold a 4.3BSD packet.
+ */
+ if (cc < (sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) {
fprintf(stderr,
"short packet (%u/%u bytes) from %s\n",
- cc, sizeof(struct tsp),
+ cc, sizeof(struct tsp) - MAXHOSTNAMELEN + 32,
inet_ntoa(from.sin_addr));
continue;
}
@@ -484,9 +489,15 @@
warn("recvfrom");
return;
}
- if (cc < sizeof(struct tsp)) {
- fprintf(stderr, "short pack (%u/%u bytes) from %s\n",
- cc, sizeof(struct tsp), inet_ntoa(from.sin_addr));
+ /*
+ * The 4.3BSD protocol spec had a 32-byte tsp_name field, and
+ * this is still OS-dependent. Demand that the packet is at
+ * least long enough to hold a 4.3BSD packet.
+ */
+ if (cc < (sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) {
+ fprintf(stderr, "short packet (%u/%u bytes) from %s\n",
+ cc, sizeof(struct tsp) - MAXHOSTNAMELEN + 32,
+ inet_ntoa(from.sin_addr));
return;
}
bytehostorder(&msg);
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010819022144.A74424>
