Eggdev: putlog patch

Darko Ilic darko at onvol.net
Sat Mar 13 13:52:10 CST 2004


Hello,

There is a bug in misc.c within the putlog function that managed to stay 
hidden for so long because it only shows in the unlikely event of 
someone not logging the timestamps. However, if timestamps are off 
(log-time is zero) the  charachter array holding the timestamp (char 
stamp[34]) will be uninitialized, making subsequent call to fprintf 
produce garbage and even crash (in the part that deals with the `last 
line repeats X times' part of function).

Moreover, pointer to time structure t (struct tm *t) will point to a 
space possibly (and usually) containing garbage and if keep-all-logs is 
set to 1, ultimatly lead to segment violation in the call to egg_strftime()

Reproducing is trivial:

.set log-time 0
.set keep-all-logs 1

Patch is trivial as well - take initialisation of pointer t out of the 
if clause (so to always be initialised) and set the first element of 
stamp to NUL char.

Patch against 1.6.15 has been sent to patches at eggheads.org

Regards,

Darko Ilic
darko`` @ undernet




More information about the Eggdev mailing list