[BusyBox-cvs] busybox/networking/udhcp ChangeLog,1.2,1.3 dhcpd.c,1.1,1.2 options.c,1.3,1.4

Russ Dill russ at busybox.net
Wed Dec 11 21:40:49 UTC 2002


Update of /var/cvs/busybox/networking/udhcp
In directory winder:/tmp/cvs-serv25695

Modified Files:
	ChangeLog dhcpd.c options.c 
Log Message:
sorry about all the noise, should be all synced up now

Index: ChangeLog
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ChangeLog	31 Oct 2002 19:21:27 -0000	1.2
+++ ChangeLog	11 Dec 2002 21:40:45 -0000	1.3
@@ -1,3 +1,10 @@
+0.9.9 (pending)
++ Added sanity check for max_leases (udhcp bug #1285) (me)
++ Finally got rid of the trailing space in enviromental vars (me)
++ added an new enviromental variable: $mask. It contains the number
+  of subnet bits for tools like ip route that require it.
+  (Bastian Blank <waldi at debian.org>, me)
+
 0.9.8 (021031)
 + split up README files (me)
 + use /dev/urandom to seed xid's (instead of time(0)) (me)

Index: dhcpd.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/dhcpd.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dhcpd.c	14 Oct 2002 21:41:26 -0000	1.1
+++ dhcpd.c	11 Dec 2002 21:40:45 -0000	1.2
@@ -95,6 +95,7 @@
 	int pid_fd;
 	int max_sock;
 	int sig;
+	unsigned long num_ips;
 	
 	OPEN_LOG("udhcpd");
 	LOG(LOG_INFO, "udhcp server (v%s) started", VERSION);
@@ -114,7 +115,15 @@
 	}
 	else server_config.lease = LEASE_TIME;
 	
-	leases = malloc(sizeof(struct dhcpOfferedAddr) * server_config.max_leases);
+	/* Sanity check */
+	num_ips = ntohl(server_config.end) - ntohl(server_config.start);
+	if (server_config.max_leases > num_ips) {
+		LOG(LOG_ERR, "max_leases value (%lu) not sane, setting to %lu instead",
+			server_config.max_leases, num_ips);
+		server_config.max_leases = num_ips;
+	}
+
+	leases = xmalloc(sizeof(struct dhcpOfferedAddr) * server_config.max_leases);
 	memset(leases, 0, sizeof(struct dhcpOfferedAddr) * server_config.max_leases);
 	read_leases(server_config.lease_file);
 

Index: options.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/options.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- options.c	11 Dec 2002 21:12:45 -0000	1.3
+++ options.c	11 Dec 2002 21:40:46 -0000	1.4
@@ -214,8 +214,8 @@
 		DEBUG(LOG_INFO, "Attaching option %s to list", option->name);
 		
 		/* make a new option */
-		new = malloc(sizeof(struct option_set));
-		new->data = malloc(length + 2);
+		new = xmalloc(sizeof(struct option_set));
+		new->data = xmalloc(length + 2);
 		new->data[OPT_CODE] = option->code;
 		new->data[OPT_LEN] = length;
 		memcpy(new->data + 2, buffer, length);




More information about the busybox-cvs mailing list