Package: dhcp3
Version:3.0.6-1

Following some testing I was reviewing the code in dhcp3-client which
handles the client leases file, and based on my inspection of the code
I think there are bugs in the error handling of writes to this file.

 * write_client_lease assumes that errno will only be set nonzero by
   failed writes.  This is not guaranteed; you _are_ guaranteed that
   errno will be set if an error occurs but you're _not_ guaranteed
   that successful calls to libc functions do not set errno.

 * write_client_lease is capable of writing corrupt lease
   records if some but not all of the fprintfs fail.  In particular,
   if an earlier fprintf fails but a later one success (for example
   because the disk is full for the first write and not for the
   second) then the file could contain syntax errors or even incorrect
   information.  The code in dhcp3-client should abandon the efforts to
   write more text if any prior write fails.  If any write fails then
   the next update must be done with rewrite_client_leases since the
   exact contents of the old leases file are not known.

 * rewrite_client_leases should write the new leases file out to a
   temporary file and use rename(2) to install it.  This will ensure
   that in case of write errors at least the previous file is
   preserved.

I imagine that there are similar mistakes in other parts of the dhcp3
source.

Ian.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to