Rob Shearman : wininet: Fix behaviour of InternetTimeFromSystemTimeA/ W when dealing with invalid parameters.
Alexandre Julliard
julliard at winehq.org
Mon Oct 6 09:35:10 CDT 2008
Module: wine
Branch: master
Commit: 7ffaafb2652e59c3f3966c2a533562932e0a07a2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7ffaafb2652e59c3f3966c2a533562932e0a07a2
Author: Rob Shearman <robertshearman at gmail.com>
Date: Fri Oct 3 12:58:32 2008 +0100
wininet: Fix behaviour of InternetTimeFromSystemTimeA/W when dealing with invalid parameters.
---
dlls/wininet/internet.c | 9 +++++++++
dlls/wininet/tests/internet.c | 6 ------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index ea1d294..4b33ca6 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -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 );
+ if (!time || !string || format != INTERNET_RFC1123_FORMAT)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
@@ -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 );
if (!time || !string || format != INTERNET_RFC1123_FORMAT)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
+ }
if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
{
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 91d72cc..5fbfd76 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -386,7 +386,6 @@ static void InternetTimeFromSystemTimeA_test(void)
ret = pInternetTimeFromSystemTimeA( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
- todo_wine
ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
error );
@@ -395,7 +394,6 @@ static void InternetTimeFromSystemTimeA_test(void)
SetLastError(0xdeadbeef);
ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
error = GetLastError();
- todo_wine
ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
@@ -406,7 +404,6 @@ static void InternetTimeFromSystemTimeA_test(void)
ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
- todo_wine
ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
error );
@@ -441,7 +438,6 @@ static void InternetTimeFromSystemTimeW_test(void)
ret = pInternetTimeFromSystemTimeW( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
- todo_wine
ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
error );
@@ -451,7 +447,6 @@ static void InternetTimeFromSystemTimeW_test(void)
ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
- todo_wine
ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
error );
@@ -461,7 +456,6 @@ static void InternetTimeFromSystemTimeW_test(void)
ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
- todo_wine
ok( error == ERROR_INVALID_PARAMETER,
"InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
error );
More information about the wine-cvs
mailing list