From 80961f3ca90ab48470fad8bb2310f19896ec9b7b Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Sun, 7 Nov 2004 14:24:25 +0000 Subject: 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. --- Modules/socketmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e239caf..3c17e9c 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; -- cgit v0.12