summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-25 15:08:10 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-25 15:08:10 (GMT)
commit0452049b6f3c8f78193b0f83072b357264dbcb1c (patch)
tree140629962566ce943030a335aa80645242856397 /Modules
parent3bbbc49060c3a420a339b9d00ec9cf1c95200c82 (diff)
downloadcpython-0452049b6f3c8f78193b0f83072b357264dbcb1c.zip
cpython-0452049b6f3c8f78193b0f83072b357264dbcb1c.tar.gz
cpython-0452049b6f3c8f78193b0f83072b357264dbcb1c.tar.bz2
Fix SF bug #1476111: SystemError in socket sendto. The AF_INET6 and
AF_PACKET cases in getsockaddrarg were missing their own checks for tuple-ness of the address argument, which means a confusing SystemError was raised by PyArg_ParseTuple instead.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 39a0240..b77f41e 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1217,6 +1217,14 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
int port, flowinfo, scope_id, result;
addr = (struct sockaddr_in6*)&(s->sock_addr).in6;
flowinfo = scope_id = 0;
+ if (!PyTuple_Check(args)) {
+ PyErr_Format(
+ PyExc_TypeError,
+ "getsockaddrarg: "
+ "AF_INET6 address must be tuple, not %.500s",
+ args->ob_type->tp_name);
+ return 0;
+ }
if (!PyArg_ParseTuple(args, "eti|ii",
"idna", &host, &port, &flowinfo,
&scope_id)) {
@@ -1319,6 +1327,14 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
char *haddr = NULL;
unsigned int halen = 0;
+ if (!PyTuple_Check(args)) {
+ PyErr_Format(
+ PyExc_TypeError,
+ "getsockaddrarg: "
+ "AF_PACKET address must be tuple, not %.500s",
+ args->ob_type->tp_name);
+ return 0;
+ }
if (!PyArg_ParseTuple(args, "si|iis#", &interfaceName,
&protoNumber, &pkttype, &hatype,
&haddr, &halen))