Bug#699775: proftpd-basic: Wrong filesystem size in welcome message

Adrian Knoth adi at drcomp.erfurt.thur.de
Mon Feb 4 20:55:32 UTC 2013


Package: proftpd-basic
Severity: minor
Tags: upstream patch

Hi!

proftpd prints the wrong unit prefix if you put "%f" in your welcome
message, it's always an order of magnitude too large, e.g., 500TB
instead of 500GB.

The culprit is format_size_str() in src/display.c, the i variable is
always off by one. Note that you could also do a "i--;" after the while
loop, however, for the corner case of filesystems smaller than 1KB, this
would result in "i == -1" which would be "MAX_INT" given its current
"unsigned declaration".

I hence took the liberty to convert it to signed, start at -1 and
increment it in every iteration, so the index into the units[] array
remains correct.

I also dropped the "register" qualifier, the compiler would choose it
anyway if appropriate.

Please forward this patch to upstream, I don't want to deal with its
bugtracker. I assume that the Debian package maintainer is already in
permament contact with upstream. ;)


Cheers

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7.4 (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proftpd.patch
Type: text/x-diff
Size: 737 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-proftpd-maintainers/attachments/20130204/2ff40f58/attachment.patch>


More information about the Pkg-proftpd-maintainers mailing list