]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix apparently trivial buffer overflow (SF bug 1060396).
authorJeremy Hylton <jeremy@alum.mit.edu>
Sun, 7 Nov 2004 14:24:25 +0000 (14:24 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Sun, 7 Nov 2004 14:24:25 +0000 (14:24 +0000)
memset() wrote one past the end of the buffer, which was likely to be unused padding or a yet-to-be-initialized local variable.  This routine is already tested by test_socket.

Modules/socketmodule.c

index e239caf013a9b66e994cb1cb314756a69ec27b62..3c17e9ce48b38694e4c21177babf90c91925f7b6 100644 (file)
@@ -3351,7 +3351,7 @@ socket_inet_ntop(PyObject *self, PyObject *args)
 #endif
        
        /* Guarantee NUL-termination for PyString_FromString() below */
-       memset((void *) &ip[0], '\0', sizeof(ip) + 1);
+       memset((void *) &ip[0], '\0', sizeof(ip));
 
        if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) {
                return NULL;