wprintf/vfprintf.c vs. large precision: allocates far too much memory

Ulrich Drepper drepper@redhat.com
Mon May 7 03:46:00 GMT 2007


Jim Meyering wrote:
>>> -	    len = prec != -1 ? (size_t) prec : strlen (mbs);		      \
>>> +	    len = strlen (mbs);						      \
>>> +	    if (prec != -1)						      \
>>> +	      len = (size_t) prec;					      \

The right thing to do is to use strnlen().  See the code I checked in.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖



More information about the Libc-alpha mailing list