Commit 7ffaafb2 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

wininet: Fix behaviour of InternetTimeFromSystemTimeA/W when dealing with invalid parameters.

parent 2584323f
...@@ -2478,6 +2478,12 @@ BOOL WINAPI InternetTimeFromSystemTimeA( const SYSTEMTIME* time, DWORD format, L ...@@ -2478,6 +2478,12 @@ BOOL WINAPI InternetTimeFromSystemTimeA( const SYSTEMTIME* time, DWORD format, L
TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size ); TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size );
if (!time || !string || format != INTERNET_RFC1123_FORMAT)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string)) if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
{ {
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
...@@ -2502,7 +2508,10 @@ BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, L ...@@ -2502,7 +2508,10 @@ BOOL WINAPI InternetTimeFromSystemTimeW( const SYSTEMTIME* time, DWORD format, L
TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size ); TRACE( "%p 0x%08x %p 0x%08x\n", time, format, string, size );
if (!time || !string || format != INTERNET_RFC1123_FORMAT) if (!time || !string || format != INTERNET_RFC1123_FORMAT)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
}
if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string)) if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
{ {
......
...@@ -386,7 +386,6 @@ static void InternetTimeFromSystemTimeA_test(void) ...@@ -386,7 +386,6 @@ static void InternetTimeFromSystemTimeA_test(void)
ret = pInternetTimeFromSystemTimeA( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) ); ret = pInternetTimeFromSystemTimeA( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
error = GetLastError(); error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" ); ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
todo_wine
ok( error == ERROR_INVALID_PARAMETER, ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n", "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
error ); error );
...@@ -395,7 +394,6 @@ static void InternetTimeFromSystemTimeA_test(void) ...@@ -395,7 +394,6 @@ static void InternetTimeFromSystemTimeA_test(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) ); ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
error = GetLastError(); error = GetLastError();
todo_wine
ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" ); ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
ok( error == ERROR_INVALID_PARAMETER, ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n", "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
...@@ -406,7 +404,6 @@ static void InternetTimeFromSystemTimeA_test(void) ...@@ -406,7 +404,6 @@ static void InternetTimeFromSystemTimeA_test(void)
ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) ); ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
error = GetLastError(); error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" ); ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
todo_wine
ok( error == ERROR_INVALID_PARAMETER, ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n", "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
error ); error );
...@@ -441,7 +438,6 @@ static void InternetTimeFromSystemTimeW_test(void) ...@@ -441,7 +438,6 @@ static void InternetTimeFromSystemTimeW_test(void)
ret = pInternetTimeFromSystemTimeW( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) ); ret = pInternetTimeFromSystemTimeW( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
error = GetLastError(); error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" ); ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
todo_wine
ok( error == ERROR_INVALID_PARAMETER, ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n", "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
error ); error );
...@@ -451,7 +447,6 @@ static void InternetTimeFromSystemTimeW_test(void) ...@@ -451,7 +447,6 @@ static void InternetTimeFromSystemTimeW_test(void)
ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) ); ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
error = GetLastError(); error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" ); ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
todo_wine
ok( error == ERROR_INVALID_PARAMETER, ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n", "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
error ); error );
...@@ -461,7 +456,6 @@ static void InternetTimeFromSystemTimeW_test(void) ...@@ -461,7 +456,6 @@ static void InternetTimeFromSystemTimeW_test(void)
ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) ); ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
error = GetLastError(); error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" ); ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
todo_wine
ok( error == ERROR_INVALID_PARAMETER, ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n", "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
error ); error );
......
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