From: nobu.nokada@... Date: 2003-04-18T18:09:38+09:00 Subject: Re: Possible bug? Hi, At Fri, 18 Apr 2003 16:52:21 +0900, U.Nakamura wrote: > | > | vsnprintf() and snprintf() are used many times. And they are > | > | not provided by MSVCRT directly but defiend in win32/win32.h. > | > | I'd propose to define them in win32/win32.c instead. > | > > | > Is this problem only on win32 platforms? > | > I suspect that this is not right. > | > | Other platforms which don't have them use missing/vsnprintf.c > | instead. Win32 platforms use _vsnprintf()/_snprintf(), but > | they are not vsnprintf()/snprintf() themselves. > > (1) Some platforms have the correct (set null at the end of buffer) > (v)snprintf. It's OK. > (2) Some platforms don't have (v)snprintf. Ruby uses missing/vsnprintf.c. > It's OK. > (3) Win32 platforms have _(v)snprintf, and they are broken. > Your patch totally fix the problem, I agree. > (4) I doubt some other platforms exist. The platforms have the wrong > (v)snprintf just like win32's _(v)snprintf. > > If (4) is right, we should fix all (v)snprintf call at all. You're right. But snprintf() is used so many times, isn't it better to make a function or a macro? And also, err_snprintf() wrongly assumes that snprintf() never overflow or returns truncated size. -- Nobu Nakada