From: Jacob Czekalla jczekalla@codeweavers.com
Time strings like "25" were parsed as-is instead of "2025". --- dlls/wininet/internet.c | 5 +++++ dlls/wininet/tests/internet.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 5d7b48a3069..94f72af3d6f 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -4014,7 +4014,12 @@ static inline BOOL calc_time(SYSTEMTIME* time, const WCHAR **s, WCHAR *end)
static inline BOOL calc_year(SYSTEMTIME* time, const WCHAR **s, WCHAR *end) { + WORD current_year = time->wYear; + + if (**s == '\0') return TRUE; time->wYear = wcstol( *s, &end, 10 ); + if (1601 > time->wYear) /* year should be between 1601 and 30827 inclusive */ + time->wYear += (current_year - (current_year % 1000)); *s = end; return FALSE; } diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index 668b6990840..d9efa415d08 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -1128,10 +1128,10 @@ static void test_InternetTimeToSystemTime(void) { "2, 11*01/2022 11+13=05", &expect2, TRUE }, { "2, 11-Jan-2022 11:13:05", &expect2, TRUE }, { "Fr", NULL, FALSE }, - { "Fri Jan 7 12:06:35 2005", &expect1, TRUE, TRUE }, - { "Fri Jan 7 12:06:35 2005 GMT", &expect1, TRUE, TRUE }, - { "Fri Jan 7 12:06:35 2005 UTC", &expect1, TRUE, TRUE }, - { "Fri, 7-Jan-05 12:06:35 GMT", &expect1, TRUE, TRUE } + { "Fri Jan 7 12:06:35 2005", &expect1, TRUE }, + { "Fri Jan 7 12:06:35 2005 GMT", &expect1, TRUE }, + { "Fri Jan 7 12:06:35 2005 UTC", &expect1, TRUE }, + { "Fri, 7-Jan-05 12:06:35 GMT", &expect1, TRUE } };
ret = pInternetTimeToSystemTimeA(NULL, NULL, 0);