]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Take dhcp packet as an argument instead of converting. Limit length of hardware...
authorTed Lemon <source@isc.org>
Thu, 25 Jun 1998 03:39:04 +0000 (03:39 +0000)
committerTed Lemon <source@isc.org>
Thu, 25 Jun 1998 03:39:04 +0000 (03:39 +0000)
relay/dhcrelay.c

index 49bea5f4ed32e99cd55d01c7b986d1e833c2a40c..5a7edb29720b4f53ef67ca1e97690504f7597351 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcrelay.c,v 1.12 1998/03/16 06:16:54 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcrelay.c,v 1.13 1998/06/25 03:39:04 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -227,18 +227,22 @@ int main (argc, argv, envp)
 
 void relay (ip, packbuf, length, from_port, from, hfrom)
        struct interface_info *ip;
-       u_int8_t *packbuf;
+       struct dhcp_packet *packet;
        int length;
        unsigned int from_port;
        struct iaddr from;
        struct hardware *hfrom;
 {
-       struct dhcp_packet *packet = (struct dhcp_packet *)packbuf;
        struct server_list *sp;
        struct sockaddr_in to;
        struct interface_info *out;
        struct hardware hto;
 
+       if (packet -> hlen > sizeof packet -> chaddr) {
+               note ("Discarding packet with invalid hlen.");
+               return;
+       }
+
        /* If it's a bootreply, forward it to the client. */
        if (packet -> op == BOOTREPLY) {
 #ifndef USE_FALLBACK