summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>2000-10-15 18:54:29 +0000
committerTed Lemon <source@isc.org>2000-10-15 18:54:29 +0000
commite28dccc15987111e8bc90a6ee535dbeb58dfaf46 (patch)
tree33595e6a6bb6f6bb3966cbae704712eea6e9c863
parent848c25472ad28139bab194474bdb77a7792c8461 (diff)
downloadisc-dhcp-e28dccc15987111e8bc90a6ee535dbeb58dfaf46.tar.gz
Fix the math in the udp packet length calculator.
-rw-r--r--common/packet.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/packet.c b/common/packet.c
index 28bea1be..a34aae19 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.38 2000/10/14 07:56:59 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.39 2000/10/15 18:54:29 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -254,7 +254,8 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
#endif /* USERLAND_FILTER */
ulen = ntohs (udp -> uh_ulen);
- if (ulen < sizeof udp || ((unsigned char *)udp) + ulen > buf + buflen) {
+ if (ulen < sizeof *udp ||
+ ((unsigned char *)udp) + ulen > buf + bufix + buflen) {
log_info ("bogus UDP packet length: %d", ulen);
return -1;
}