dhcp/dhcp-3.0.5-memory.patch

53 lines
1.5 KiB
Diff
Raw Normal View History

--- dhcp-3.0.5/common/packet.c.memory 2005-03-03 11:55:23.000000000 -0500
+++ dhcp-3.0.5/common/packet.c 2007-03-30 17:11:06.000000000 -0400
@@ -140,6 +140,7 @@
struct ip ip;
struct udphdr udp;
+ memset( &ip, '\0', sizeof ip);
/* Fill out the IP header */
IP_V_SET (&ip, 4);
IP_HL_SET (&ip, 20);
@@ -219,7 +220,7 @@
{
unsigned char *data;
struct ip ip;
- struct udphdr *udp;
+ struct udphdr udph, *udp=&udph;
u_int32_t ip_len = (buf [bufix] & 0xf) << 2;
u_int32_t sum, usum;
static int ip_packets_seen;
@@ -233,7 +234,7 @@
int ignore = 0;
memcpy(&ip, buf + bufix, sizeof (struct ip));
- udp = (struct udphdr *)(buf + bufix + ip_len);
+ memcpy(udp, buf + bufix + ip_len, sizeof(struct udphdr));
#ifdef USERLAND_FILTER
/* Is it a UDP packet? */
--- dhcp-3.0.5/common/lpf.c.memory 2007-03-30 17:11:06.000000000 -0400
+++ dhcp-3.0.5/common/lpf.c 2007-03-30 17:11:55.000000000 -0400
@@ -246,6 +246,7 @@
struct interface_info *info;
{
struct sock_fprog p;
+ memset(&p,'\0', sizeof(struct sock_fprog));
/* Set up the bpf filter program structure. This is defined in
bpf.c */
--- dhcp-3.0.5/minires/ns_name.c.memory 2004-06-10 13:59:40.000000000 -0400
+++ dhcp-3.0.5/minires/ns_name.c 2007-03-30 17:11:06.000000000 -0400
@@ -71,6 +71,11 @@
dn = dst;
eom = dst + dstsiz;
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+
while ((n = *cp++) != 0) {
if ((n & NS_CMPRSFLGS) != 0) {
/* Some kind of compression pointer. */