This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: Problem with snprintf()
- To: Egor Duda <deo at logos-m dot ru>
- Subject: Re: Problem with snprintf()
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Wed, 09 Aug 2000 14:17:37 -0400
- CC: Chris Faylor <cgf at cygnus dot com>, newlib <newlib at sources dot redhat dot com>
- Organization: Red Hat Inc.
- References: <20000808194526.C23329@cygnus.com> <9461.000809@logos-m.ru>
Egor Duda wrote:
>
> Hi!
>
> Wednesday, 09 August, 2000 Chris Faylor cgf@cygnus.com wrote:
>
> >>>So snprintf() should always add a terminating \0.
> >>
> >>And snprintf() may return -1 only in case of encoding error, not if the
> >>string exceeds `size'. So that is answered as well, IMO.
>
> CF> So, have we come up with a patch for this behavior?
>
> i've posted one in http://sources.redhat.com/ml/newlib/2000/msg00183.html
>
> i believe it'll make (v)snprintf C99-compliant
>
> if there're no objections, will somebody kindly check it in?
>
> Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
I posted a patch yesterday. It fixes the problem plus it also handles the
case whereby size is 0 (writes nothing and allows a null pointer to be
passed).
-- Jeff J.