Re: AW: AW: [xml] xmlTextWriter



On Wed, Oct 08, 2003 at 10:38:42AM +0200, Mickautsch, Alfred wrote:
Was interesting to see you did printf like functions btw. :) 
are those safe 
for overflows and such ?

They use vsnprintf internally, so they are safe for buffer overflows. I did a little searching and found 
out that vsnprintf isn't very portable (different implementations return different values for the same 
errors). So I will have to fix that.
Output truncating if the buffer is too small is still a problem, so I will have to call vsnprintf in a loop 
until it returns a value less than the size of the buffer.
And if vsnprintf returns a negative value, errno should be checked, of course... you never know what errors 
you can get :-(


does any other part oflixml use printf like functions anyways ?

I saw an xmlStrPrintf mentioned on the list not so long ago (obviously) :)

  We use the TRIO set of *printf reimplementation for platforms where
they are not available. So there should be no portability issues, it's
already dealt with. I'm not sure what your problems are in practice.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]