[Python-Dev] Overflow in socketmodule.c?

Mihai Ibanescu misa at redhat.com
Thu Nov 4 16:38:19 CET 2004


Hello,

Can someone confirm this is indeed an overflow by one in socketmodule.c?


static PyObject *
socket_inet_ntop(PyObject *self, PyObject *args)
{
        int af;
        char* packed;
        int len;
        const char* retval;
#ifdef ENABLE_IPV6
        char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
#else
        char ip[INET_ADDRSTRLEN + 1];
#endif

        /* Guarantee NUL-termination for PyString_FromString() below */
        memset((void *) &ip[0], '\0', sizeof(ip) + 1);


If it is I'll go ahead and file it.

Thanks,
Misa


More information about the Python-Dev mailing list