CNFS offset problems

Russ Allbery rra at stanford.edu
Tue Jan 21 19:20:55 UTC 2003


bill davidsen <davidsen at tmr.com> writes:

>   I guess the real question which comes to my mind is why the article
> length is unsigned in the first place.

I changed that for 2.4 intentionally, because a negative article length
doesn't make any sense and because it might conceivably matter at some
point if people try to deal with really large articles.  size_t is really
the right data type.  I wasn't particularly comfortable with just using an
int (and in general, there are a lot of places where INN uses an int that
should be a size_t).

The real API problem is that off_t is signed, which is because of negative
offsets with fseek.  Ah well.

Making the article length size_t made a bunch of *other* warnings go away,
where the article length was compared to things like strlen that return
size_t, or ntohl, which returns a uint32_t.  Basically, either way I think
we'll need to fix some code and pay attention to overflow and conversion
issues.

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

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list