From: Jeremy Hylton Date: Sun, 7 Nov 2004 14:24:25 +0000 (+0000) Subject: Fix apparently trivial buffer overflow (SF bug 1060396). X-Git-Tag: v2.4c1~77 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=80961f3ca90ab48470fad8bb2310f19896ec9b7b;p=thirdparty%2FPython%2Fcpython.git Fix apparently trivial buffer overflow (SF bug 1060396). 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. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e239caf013a9..3c17e9ce48b3 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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;