summaryrefslogtreecommitdiff
path: root/networking/udhcp/files.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-07-07 14:59:30 +0200
committerDenys Vlasenko2009-07-07 14:59:30 +0200
commit95cc814dbd37a4cb5a69b5eac80bd3e5173fe908 (patch)
treee5adfbc603dd9b70371a77c5f1a5c19ba937f4ae /networking/udhcp/files.c
parenta51543a3a486ca60018394dda2623fdf1f16a965 (diff)
downloadbusybox-95cc814dbd37a4cb5a69b5eac80bd3e5173fe908.zip
busybox-95cc814dbd37a4cb5a69b5eac80bd3e5173fe908.tar.gz
udhcpd: fix a bug in add_lease where it was reading at [-1]
It is not correct when we read lease file! Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r--networking/udhcp/files.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 3559215..1b2cc96 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -420,7 +420,11 @@ void FAST_FUNC read_leases(const char *file)
continue;
/* NB: add_lease takes "relative time", IOW,
* lease duration, not lease deadline. */
- if (!(add_lease(lease.lease_mac, lease.lease_nip, expires, lease.hostname))) {
+ if (add_lease(lease.lease_mac, lease.lease_nip,
+ expires,
+ lease.hostname, sizeof(lease.hostname)
+ ) == 0
+ ) {
bb_error_msg("too many leases while loading %s", file);
break;
}