calloc in nnrpd/perl.c

Erik Klavon erik at eriq.org
Sun Mar 3 19:27:27 UTC 2002


On Sun, Mar 03, 2002 at 09:55:00AM -0800, Russ Allbery wrote:
> > Hmm.  I don't know why there's an itoa() being defined in that file in
> > the first place -- it seems like sprintf would do as well -- but by my
> > reading of strcat, that shouldn't even work, since the dst array is not
> > large enough to hold the result of the concatenation.
> 
> That code is bizarre.
> 
> I believe that itoa will explode with any number larger than 9, which is
> convenient since I don't think it will ever be called with a number larger
> than 9.  But that code and everything related to it really needs to be
> rethought from scratch.
> 
> The first element of the array that's being constructed is a string
> representation of the number of items in the array, which is only used as
> an argument to atoi in the caller to get the array length.  It looks like
> someone really wanted a vector, which we now have in libinn.  That would
> require some fiddling in perm.c, but I think it's probably the clean
> solution.

I'll claim the bizarre code. I'll rework it using a vector in place of
an array and dump itoa.

Erik

-- 
erik         | "It is idle to think that, by means of words, | Maurice
  kl at von     | any real communication can ever pass | Maeterlinck
    eriq.org | from one [human] to another." | Silence


More information about the inn-workers mailing list