Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cc143cd8
Commit
cc143cd8
authored
Jun 24, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9566: _winapi.WriteFile() now truncates length to DWORD_MAX (4294967295)
parent
05b3b1ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
Modules/_winapi.c
Modules/_winapi.c
+5
-2
No files found.
Modules/_winapi.c
View file @
cc143cd8
...
@@ -62,6 +62,8 @@
...
@@ -62,6 +62,8 @@
#define T_HANDLE T_POINTER
#define T_HANDLE T_POINTER
#define DWORD_MAX 4294967295U
/* Grab CancelIoEx dynamically from kernel32 */
/* Grab CancelIoEx dynamically from kernel32 */
static
int
has_CancelIoEx
=
-
1
;
static
int
has_CancelIoEx
=
-
1
;
static
BOOL
(
CALLBACK
*
Py_CancelIoEx
)(
HANDLE
,
LPOVERLAPPED
);
static
BOOL
(
CALLBACK
*
Py_CancelIoEx
)(
HANDLE
,
LPOVERLAPPED
);
...
@@ -1142,7 +1144,7 @@ winapi_WriteFile(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1142,7 +1144,7 @@ winapi_WriteFile(PyObject *self, PyObject *args, PyObject *kwds)
HANDLE
handle
;
HANDLE
handle
;
Py_buffer
_buf
,
*
buf
;
Py_buffer
_buf
,
*
buf
;
PyObject
*
bufobj
;
PyObject
*
bufobj
;
DWORD
written
;
DWORD
len
,
written
;
BOOL
ret
;
BOOL
ret
;
int
use_overlapped
=
0
;
int
use_overlapped
=
0
;
DWORD
err
;
DWORD
err
;
...
@@ -1170,7 +1172,8 @@ winapi_WriteFile(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1170,7 +1172,8 @@ winapi_WriteFile(PyObject *self, PyObject *args, PyObject *kwds)
}
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
ret
=
WriteFile
(
handle
,
buf
->
buf
,
buf
->
len
,
&
written
,
len
=
(
DWORD
)
Py_MIN
(
buf
->
len
,
DWORD_MAX
);
ret
=
WriteFile
(
handle
,
buf
->
buf
,
len
,
&
written
,
overlapped
?
&
overlapped
->
overlapped
:
NULL
);
overlapped
?
&
overlapped
->
overlapped
:
NULL
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment