mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
This commit is contained in:
parent
ca2dc4798b
commit
9f12d468f4
2 changed files with 52 additions and 28 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue