Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
cb72110d
Commit
cb72110d
authored
Aug 27, 2003
by
Jason Rumney
Browse files
(sys_pipe): Protect against file descriptor overflow.
parent
d3703de3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
src/w32.c
src/w32.c
+15
-4
No files found.
src/w32.c
View file @
cb72110d
...
...
@@ -3450,11 +3450,22 @@ sys_pipe (int * phandles)
if (rc == 0)
{
flags
=
FILE_PIPE
|
FILE_READ
|
FILE_BINARY
;
fd_info
[
phandles
[
0
]].
flags
=
flags
;
/* Protect against overflow, since Windows can open more handles than
our fd_info array has room for. */
if (phandles[0] >= MAXDESC || phandles[1] >= MAXDESC)
{
_close (phandles[0]);
_close (phandles[1]);
rc = -1;
}
else
{
flags = FILE_PIPE | FILE_READ | FILE_BINARY;
fd_info[phandles[0]].flags = flags;
flags
=
FILE_PIPE
|
FILE_WRITE
|
FILE_BINARY
;
fd_info
[
phandles
[
1
]].
flags
=
flags
;
flags = FILE_PIPE | FILE_WRITE | FILE_BINARY;
fd_info[phandles[1]].flags = flags;
}
}
return rc;
...
...
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