summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-19 10:41:45 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-19 10:41:45 (GMT)
commit9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3 (patch)
treec61aebdba4dddc8f10c9460ca33b0fa3f2e1495d /Modules/socketmodule.c
parentbd8f29028eab752e8e5c73703218a701028c1a9a (diff)
parent441d30fac7f4037e4a79e4ada873de3b6f6e5a26 (diff)
downloadcpython-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.zip
cpython-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.tar.gz
cpython-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.tar.bz2
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index d8c81fe..d7aef8f 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2073,7 +2073,7 @@ For IP sockets, the address info is a pair (hostaddr, port).");
static PyObject *
sock_setblocking(PySocketSockObject *s, PyObject *arg)
{
- int block;
+ long block;
block = PyLong_AsLong(arg);
if (block == -1 && PyErr_Occurred())
@@ -2555,7 +2555,7 @@ sock_listen(PySocketSockObject *s, PyObject *arg)
int backlog;
int res;
- backlog = PyLong_AsLong(arg);
+ backlog = _PyLong_AsInt(arg);
if (backlog == -1 && PyErr_Occurred())
return NULL;
Py_BEGIN_ALLOW_THREADS
@@ -3712,7 +3712,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
int how;
int res;
- how = PyLong_AsLong(arg);
+ how = _PyLong_AsInt(arg);
if (how == -1 && PyErr_Occurred())
return NULL;
Py_BEGIN_ALLOW_THREADS