diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32.c | 19 |
1 files changed, 15 insertions, 4 deletions
| @@ -3450,11 +3450,22 @@ sys_pipe (int * phandles) | |||
| 3450 | 3450 | ||
| 3451 | if (rc == 0) | 3451 | if (rc == 0) |
| 3452 | { | 3452 | { |
| 3453 | flags = FILE_PIPE | FILE_READ | FILE_BINARY; | 3453 | /* Protect against overflow, since Windows can open more handles than |
| 3454 | fd_info[phandles[0]].flags = flags; | 3454 | our fd_info array has room for. */ |
| 3455 | if (phandles[0] >= MAXDESC || phandles[1] >= MAXDESC) | ||
| 3456 | { | ||
| 3457 | _close (phandles[0]); | ||
| 3458 | _close (phandles[1]); | ||
| 3459 | rc = -1; | ||
| 3460 | } | ||
| 3461 | else | ||
| 3462 | { | ||
| 3463 | flags = FILE_PIPE | FILE_READ | FILE_BINARY; | ||
| 3464 | fd_info[phandles[0]].flags = flags; | ||
| 3455 | 3465 | ||
| 3456 | flags = FILE_PIPE | FILE_WRITE | FILE_BINARY; | 3466 | flags = FILE_PIPE | FILE_WRITE | FILE_BINARY; |
| 3457 | fd_info[phandles[1]].flags = flags; | 3467 | fd_info[phandles[1]].flags = flags; |
| 3468 | } | ||
| 3458 | } | 3469 | } |
| 3459 | 3470 | ||
| 3460 | return rc; | 3471 | return rc; |