summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2009-12-23 09:31:11 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2009-12-23 09:31:11 (GMT)
commit9f12d468f4f886d70831b34875e95d5efe9c6323 (patch)
tree5de370d3801cce7036992a2feec2c1d105dd3ba4 /Modules
parentca2dc4798bab9aa2841c15da5d3f1c0be48f2532 (diff)
downloadcpython-9f12d468f4f886d70831b34875e95d5efe9c6323.zip
cpython-9f12d468f4f886d70831b34875e95d5efe9c6323.tar.gz
cpython-9f12d468f4f886d70831b34875e95d5efe9c6323.tar.bz2
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8956e93..76609ee 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1910,9 +1910,10 @@ fd to the numeric uid and gid.");
static PyObject *
posix_fchown(PyObject *self, PyObject *args)
{
- int fd, uid, gid;
+ int fd;
+ long uid, gid;
int res;
- if (!PyArg_ParseTuple(args, "iii:chown", &fd, &uid, &gid))
+ if (!PyArg_ParseTuple(args, "ill:chown", &fd, &uid, &gid))
return NULL;
Py_BEGIN_ALLOW_THREADS
res = fchown(fd, (uid_t) uid, (gid_t) gid);
@@ -1933,9 +1934,9 @@ static PyObject *
posix_lchown(PyObject *self, PyObject *args)
{
char *path = NULL;
- int uid, gid;
+ long uid, gid;
int res;
- if (!PyArg_ParseTuple(args, "etii:lchown",
+ if (!PyArg_ParseTuple(args, "etll:lchown",
Py_FileSystemDefaultEncoding, &path,
&uid, &gid))
return NULL;