diff Modules/socketmodule.c @ 33928:0d4ecc31cfd8 legacy-trunk

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.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Sun, 07 Nov 2004 14:24:25 +0000
parents 46217d05a476
children 59a63b09a4c2
line wrap: on
line diff
--- a/Modules/socketmodule.c	Sun Nov 07 14:15:28 2004 +0000
+++ b/Modules/socketmodule.c	Sun Nov 07 14:24:25 2004 +0000
@@ -3351,7 +3351,7 @@
 #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;