diff options
author | Russ Dill <Russ.Dill@asu.edu> | 2002-12-11 21:40:46 +0000 |
---|---|---|
committer | Russ Dill <Russ.Dill@asu.edu> | 2002-12-11 21:40:46 +0000 |
commit | 9f4395c54e9e5507f2a59643f62bb42ef2601aab (patch) | |
tree | dff384f34afa3444d0eb9478df78185d05c79b75 /networking/udhcp/dhcpd.c | |
parent | 920c1e8d6ca1db73366caaaf14abf242f2b851d3 (diff) | |
download | busybox-w32-9f4395c54e9e5507f2a59643f62bb42ef2601aab.tar.gz busybox-w32-9f4395c54e9e5507f2a59643f62bb42ef2601aab.tar.bz2 busybox-w32-9f4395c54e9e5507f2a59643f62bb42ef2601aab.zip |
sorry about all the noise, should be all synced up now
Diffstat (limited to 'networking/udhcp/dhcpd.c')
-rw-r--r-- | networking/udhcp/dhcpd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 6c16dfeb0..56ddaa942 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c | |||
@@ -95,6 +95,7 @@ int main(int argc, char *argv[]) | |||
95 | int pid_fd; | 95 | int pid_fd; |
96 | int max_sock; | 96 | int max_sock; |
97 | int sig; | 97 | int sig; |
98 | unsigned long num_ips; | ||
98 | 99 | ||
99 | OPEN_LOG("udhcpd"); | 100 | OPEN_LOG("udhcpd"); |
100 | LOG(LOG_INFO, "udhcp server (v%s) started", VERSION); | 101 | LOG(LOG_INFO, "udhcp server (v%s) started", VERSION); |
@@ -114,7 +115,15 @@ int main(int argc, char *argv[]) | |||
114 | } | 115 | } |
115 | else server_config.lease = LEASE_TIME; | 116 | else server_config.lease = LEASE_TIME; |
116 | 117 | ||
117 | leases = malloc(sizeof(struct dhcpOfferedAddr) * server_config.max_leases); | 118 | /* Sanity check */ |
119 | num_ips = ntohl(server_config.end) - ntohl(server_config.start); | ||
120 | if (server_config.max_leases > num_ips) { | ||
121 | LOG(LOG_ERR, "max_leases value (%lu) not sane, setting to %lu instead", | ||
122 | server_config.max_leases, num_ips); | ||
123 | server_config.max_leases = num_ips; | ||
124 | } | ||
125 | |||
126 | leases = xmalloc(sizeof(struct dhcpOfferedAddr) * server_config.max_leases); | ||
118 | memset(leases, 0, sizeof(struct dhcpOfferedAddr) * server_config.max_leases); | 127 | memset(leases, 0, sizeof(struct dhcpOfferedAddr) * server_config.max_leases); |
119 | read_leases(server_config.lease_file); | 128 | read_leases(server_config.lease_file); |
120 | 129 | ||