bug in nnrpd + solution

Russ Allbery rra at stanford.edu
Wed Apr 12 19:16:04 UTC 2006


Paul Tomblin <ptomblin at xcski.com> writes:
> Quoting Piotr Meyer (aniou at smutek.pl):

>> I think, better choice is "%u" (in to unsigned decimal):

>>         Printf("%s %010u %010u %c\r\n.\r\n", group, hi, lo, flag);

> Wouldn't a better solution be to use 64 bit longs for hi and lo?

NNTP standard says 32-bit unsigned numbers.  I do think we should use
64-bit unsigned for article numbers internally at some point, but note
that this changes the on-disk format of overview and therefore is a big
deal to change.  Plus, you can't actually send numbers larger than an
unsigned 32-bit value to clients without running a serious risk of
breaking clients (and in fact many clients will break with numbers larger
than a signed 32-bit quantity).

Piotr originally sent this to me directly, and the reason why I hadn't
responded yet is that it's unfortunately not quite as simple as this.
Really, we should be using ARTNUM instead of int for these numbers, but
the current overview API is defined to use int (rather short-sighted and
broken) and needs to be redone.

In the meantime, we can probably cast the ints to unsigned ints and win on
platforms where int is large enough, which I think is everything INN is
likely to run on right now, so this change probably isn't *bad*.  But it's
not really the long-term solution.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>



More information about the inn-bugs mailing list