Commit c2459dee authored by Jeff Zaroyko's avatar Jeff Zaroyko Committed by Alexandre Julliard

msvcrt: Check if argument passed to _dup2 is positive.

parent f4e5ab48
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment