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.
This commit is contained in:
Jeremy Hylton 2004-11-07 14:24:25 +00:00
parent f8e74b12b0
commit 80961f3ca9

View 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;