Re: [bug-gnulib] Re: extend the scope of xasprintf

2006-05-09 Thread Bruno Haible
Paul Eggert wrote: > totalsize is of type size_t, so SIZE_MAX is the problem case here, not > INT_MAX. Good point. Also a possible overflow in the xsum() calls before is needed. I'm committing this changed code. Bruno static inline char * xstrcat (size_t argcount, va_list args) { char *resu

Re: [bug-gnulib] Re: extend the scope of xasprintf

2006-05-09 Thread Bruno Haible
Eric Blake wrote: > > + p = result; > > + va_copy (ap, args); > > Why are you using va_copy a second time? vsprintf is allowed to consume > its va_list argument (aka use va_arg on it), so long as it leaves the > va_close for the caller. Right. This is an optim I had neglected. Thanks. > > +

Re: extend the scope of xasprintf

2006-05-09 Thread Paul Eggert
Eric Blake <[EMAIL PROTECTED]> writes: >> + result = (char *) xmalloc (totalsize + 1); > > What if totalsize is INT_MAX? totalsize is of type size_t, so SIZE_MAX is the problem case here, not INT_MAX. So I assume you're suggesting that the earlier "if (totalsize > INT_MAX) ..." be changed to "