summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-02-11 05:56:27 +0000
committerclaudio <claudio@openbsd.org>2015-02-11 05:56:27 +0000
commit438a503ed94455a38bff8ef5207586292553a65c (patch)
treec40cdefb3e383c272bcebf129f03c3a43f83d762
parentdeprecate use of sys/lock.h and replace it with sys/atomic.h or (diff)
downloadwireguard-openbsd-438a503ed94455a38bff8ef5207586292553a65c.tar.xz
wireguard-openbsd-438a503ed94455a38bff8ef5207586292553a65c.zip
Use sizeof(u_short) in the first check since there are RT messages that
are less then sizeof(*rtm) bytes long (e.g. interface announcements). Found the hard way by phessler@
-rw-r--r--usr.sbin/dvmrpd/kroute.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/dvmrpd/kroute.c b/usr.sbin/dvmrpd/kroute.c
index 07068d2723e..39faa9255e6 100644
--- a/usr.sbin/dvmrpd/kroute.c
+++ b/usr.sbin/dvmrpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.10 2015/02/10 08:49:30 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.11 2015/02/11 05:56:27 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -389,7 +389,7 @@ kr_dispatch_msg(int fd, short event, void *bula)
lim = buf + n;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)next;
- if (lim < next + sizeof(*rtm) ||
+ if (lim < next + sizeof(u_short) ||
lim < next + rtm->rtm_msglen)
fatalx("dispatch_rtmsg: partial rtm in buffer");
if (rtm->rtm_version != RTM_VERSION)