summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-28 20:27:42 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-28 20:27:42 (GMT)
commit885d457709c1d680c899dc3d035a47c8fb514cfa (patch)
treed16b3a6f89208a1b46b786958a316ef9075d3fab /Modules/socketmodule.c
parent05bd787c6cd55f29d43465de621778221e0fc46e (diff)
downloadcpython-885d457709c1d680c899dc3d035a47c8fb514cfa.zip
cpython-885d457709c1d680c899dc3d035a47c8fb514cfa.tar.gz
cpython-885d457709c1d680c899dc3d035a47c8fb514cfa.tar.bz2
sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 2b27e71..eccee4d 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1768,9 +1768,11 @@ PySocketSock_repr(PySocketSockObject *s)
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 @@ NTinit(void)
"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;
}