msvcrt: Check if argument passed to _dup2 is positive.

oldstable
Jeff Zaroyko 2010-01-12 14:14:33 +11:00 committed by Alexandre Julliard
parent f4e5ab4892
commit c2459deeff
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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)