[Python-Dev] Re: mysnprintf broken

Neil Schemenauer nas@python.ca
Sun, 25 Nov 2001 18:00:07 -0800


Martin v. Loewis wrote:
> Looks like the time machine is at work again: the version we use *is*
> a free snprintf implementation.

Are we looking at the same mysnprintf?  The one I have starts off:

    static
    int myvsnprintf(char *str, size_t size, const char  *format, va_list va)
    {
        char *buffer = PyMem_Malloc(size + 512);
        int len;

        if (buffer == NULL)
            return -1;
        len = vsprintf(buffer, format, va);
        ...
    

That doesn't look safe to me.  Is there another snprintf implementation
in the Python source tree?  I can't find it.  If there is then why is
mysnprintf around?

  Neil