diff Modules/socketmodule.c @ 21073:304b34023876 legacy-trunk

sprintf -> PyOS_snprintf in some "obviously safe" cases. Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
author Tim Peters <tim.peters@gmail.com>
date Wed, 28 Nov 2001 20:27:42 +0000
parents 597d10cf7938
children c2150313d9d1
line wrap: on
line diff
--- a/Modules/socketmodule.c	Wed Nov 28 20:24:33 2001 +0000
+++ b/Modules/socketmodule.c	Wed Nov 28 20:27:42 2001 +0000
@@ -1768,9 +1768,11 @@
 		return NULL;
 	}
 #endif
-	sprintf(buf,
-		"<socket object, fd=%ld, family=%d, type=%d, protocol=%d>",
-		(long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto);
+	PyOS_snprintf(buf, sizeof(buf),
+		      "<socket object, fd=%ld, family=%d, type=%d, protocol=%d>",
+		      (long)s->sock_fd, s->sock_family,
+		      s->sock_type,
+		      s->sock_proto);
 	return PyString_FromString(buf);
 }
 
@@ -3056,7 +3058,8 @@
 		    "WSAStartup failed: requested version not supported");
 		break;
 	default:
-		sprintf(buf, "WSAStartup failed: error code %d", ret);
+		PyOS_snprintf(buf, sizeof(buf),
+			      "WSAStartup failed: error code %d", ret);
 		PyErr_SetString(PyExc_ImportError, buf);
 		break;
 	}