lftp 4.0.2 was crashing for me when executing "cls -s" on Mac OS X
x86_64.
It appears human_readable() in lib/human.c assumes the passed buffer
to be at least LONGEST_HUMAN_READABLE long, as defined in lib/human.h.
LONGEST_HUMAN_READABLE calculates to 271 on this machine, bigger than
the 128-byte buffer used in FileSetOutput.cc.
This fixes it:
--- src/FileSetOutput.cc.orig 2008-11-25 12:32:14.000000000 +0100
+++ src/FileSetOutput.cc 2009-10-16 16:43:42.000000000 +0200
@@ -116,7 +116,7 @@
char sz[128];
if((f->filetype == FileInfo::NORMAL || !size_filesonly)
&& (f->defined&f->SIZE)) {
- char buffer[128];
+ char buffer[LONGEST_HUMAN_READABLE + 1];
sprintf(sz, "%8s ",
human_readable (f->size, buffer, human_opts, 1,
output_block_size? output_block_size:1024));
FindJobDu.cc, the only other use of human_readable() I could find,
already had it correct.