Module: wine Branch: master Commit: c2459deefffaef80ea78faadeb9ab7fa66a67ff6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c2459deefffaef80ea78faadeb...
Author: Jeff Zaroyko jeffz@jeffz.name Date: Tue Jan 12 14:14:33 2010 +1100
msvcrt: Check if argument passed to _dup2 is positive.
---
dlls/msvcrt/file.c | 2 +- dlls/msvcrt/tests/file.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index cbaa04e..df42d47 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -705,7 +705,7 @@ int CDECL MSVCRT__dup2(int od, int nd)
TRACE("(od=%d, nd=%d)\n", od, nd); LOCK_FILES(); - if (nd < MSVCRT_MAX_FILES && msvcrt_is_valid_fd(od)) + if (nd < MSVCRT_MAX_FILES && nd >= 0 && msvcrt_is_valid_fd(od)) { HANDLE handle;
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index 27d64bd..042a82e 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -1363,7 +1363,7 @@ static void test_unlink(void)
void test_dup2(void) { - todo_wine ok(-1 == _dup2(0, -1), "expected _dup2 to fail when second arg is negative\n" ); + ok(-1 == _dup2(0, -1), "expected _dup2 to fail when second arg is negative\n" ); }
START_TEST(file)