summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-19 12:55:39 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-19 12:55:39 +0200
commit74f49ab28b91d3c23524356230feb2724ee9b23f (patch)
tree0ddd5e8899d06c974dfc25a7dfc298e3f6f70039 /Modules/socketmodule.c
parentac7b49f4076a4336915d13a4aa19feaeadd29d62 (diff)
downloadcpython-git-74f49ab28b91d3c23524356230feb2724ee9b23f.tar.gz
Issue #15989: Fix several occurrences of integer overflow
when result of PyInt_AsLong() or 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 506a2d320b..1eaa302e7f 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1713,7 +1713,7 @@ info is a pair (hostaddr, port).");
static PyObject *
sock_setblocking(PySocketSockObject *s, PyObject *arg)
{
- int block;
+ long block;
block = PyInt_AsLong(arg);
if (block == -1 && PyErr_Occurred())
@@ -2243,7 +2243,7 @@ sock_listen(PySocketSockObject *s, PyObject *arg)
int backlog;
int res;
- backlog = PyInt_AsLong(arg);
+ backlog = _PyInt_AsInt(arg);
if (backlog == -1 && PyErr_Occurred())
return NULL;
Py_BEGIN_ALLOW_THREADS
@@ -2894,7 +2894,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
int how;
int res;
- how = PyInt_AsLong(arg);
+ how = _PyInt_AsInt(arg);
if (how == -1 && PyErr_Occurred())
return NULL;
Py_BEGIN_ALLOW_THREADS