Commit 5ebfac11 authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent e8ba808a
...@@ -3351,7 +3351,7 @@ socket_inet_ntop(PyObject *self, PyObject *args) ...@@ -3351,7 +3351,7 @@ socket_inet_ntop(PyObject *self, PyObject *args)
#endif #endif
/* Guarantee NUL-termination for PyString_FromString() below */ /* 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)) { if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) {
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment