Issue #9758: When fcntl.ioctl() was called with mutable_flag set to True,

and the passed buffer was exactly 1024 bytes long, the buffer wouldn't
be updated back after the system call.  Original patch by Brian Brazil.
This commit is contained in:
Antoine Pitrou 2010-09-07 16:30:09 +00:00
parent 7f7561ebfc
commit 5e38aae91b
3 changed files with 31 additions and 6 deletions

View file

@ -157,7 +157,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
else {
ret = ioctl(fd, code, arg);
}
if (mutate_arg && (len < IOCTL_BUFSZ)) {
if (mutate_arg && (len <= IOCTL_BUFSZ)) {
memcpy(str, buf, len);
}
PyBuffer_Release(&pstr); /* No further access to str below this point */