* filelock.c: Fix some buffer overrun and integer overflow issues.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 20 Jun 2011 03:11:40 +0000 (20:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 20 Jun 2011 03:11:40 +0000 (20:11 -0700)
commit882f0d8119c9135b06ce9b291a139e4e9c6eeff8
treed94f839b5aba81b3a9cf78554b054ef5149b63d8
parent93f4cf88953806d319e6ab231b4d1332a227d645
* filelock.c: Fix some buffer overrun and integer overflow issues.

(get_boot_time): Don't assume that gzip command string fits in 100 bytes.
Reformulate so as not to need the command string.
Invoke gzip -cd rather than gunzip, as it's more portable.
(lock_info_type, lock_file_1, lock_file):
Don't assume pid_t and time_t fit in unsigned long.
(LOCK_PID_MAX): Remove; we now use more-reliable bounds.
(current_lock_owner): Prefer signed type for sizes.
Use memcpy, not strncpy, where memcpy is what is really wanted.
Don't assume (via atoi) that time_t and pid_t fit in int.
Check for time_t and/or pid_t out of range, e.g., via a network share.
Don't alloca where an auto var works fine.
src/ChangeLog
src/filelock.c