https://git.reactos.org/?p=reactos.git;a=commitdiff;h=94e13ca59b228d671f248…
commit 94e13ca59b228d671f2482313c1fb6cd84d045d0
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Tue Dec 8 18:01:29 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Tue Jan 5 11:03:13 2021 +0100
[WINESYNC] wininet: Handle empty expires for cookie setting.
Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id c06e00ee6a15fd77faf66b28edac5e84ad30b550 by Jactry Zeng
<jzeng(a)codeweavers.com>
---
dll/win32/wininet/cookie.c | 2 +-
modules/rostests/winetests/wininet/internet.c | 18 ++++++++++++++----
sdk/tools/winesync/wininet.cfg | 2 +-
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dll/win32/wininet/cookie.c b/dll/win32/wininet/cookie.c
index 124b577288a..20de3bf3909 100644
--- a/dll/win32/wininet/cookie.c
+++ b/dll/win32/wininet/cookie.c
@@ -981,7 +981,7 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name,
substr_t data, D
substr_skip(&data, len);
- if(end_ptr - data.str < ARRAY_SIZE(buf)-1) {
+ if(end_ptr > data.str && (end_ptr - data.str < ARRAY_SIZE(buf)
- 1)) {
memcpy(buf, data.str, data.len*sizeof(WCHAR));
buf[data.len] = 0;
diff --git a/modules/rostests/winetests/wininet/internet.c
b/modules/rostests/winetests/wininet/internet.c
index e69b45a7e6f..ef1adefd1a3 100644
--- a/modules/rostests/winetests/wininet/internet.c
+++ b/modules/rostests/winetests/wininet/internet.c
@@ -510,7 +510,7 @@ static void test_complicated_cookie(void)
len = 1024;
ret =
InternetGetCookieA("http://testing.example.com/bar/foo"/foo", NULL, buffer,
&len);
ok(ret == TRUE,"InternetGetCookie failed\n");
- ok(len == 24, "len = %u\n", 24);
+ ok(len == 24, "len = %u\n", len);
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
@@ -524,16 +524,26 @@ static void test_complicated_cookie(void)
len = 1024;
ret =
InternetGetCookieA("http://testing.example.com/bar/foo"/foo", "A",
buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
- ok(len == 24, "len = %u\n", 24);
+ ok(len == 24, "len = %u\n", len);
/* test persistent cookies */
ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B;
expires=Fri, 01-Jan-2038 00:00:00 GMT");
ok(ret, "InternetSetCookie failed with error %d\n", GetLastError());
+ /* test invalid expires parameter */
+ ret = InternetSetCookieA("http://testing.example.com", NULL, "Q=R;
expires=");
+ ok(ret, "InternetSetCookie failed %#x.\n", GetLastError());
+ len = 1024;
+ memset(buffer, 0xac, sizeof(buffer));
+ ret =
InternetGetCookieA("http://testing.example.com/"com/", NULL, buffer,
&len);
+ ok(ret, "InternetGetCookie failed %#x.\n", GetLastError());
+ ok(len == 29, "got len %u.\n", len);
+ ok(!!strstr(buffer, "Q=R"), "cookie is not present.\n");
+
len = sizeof(buffer);
ret =
InternetGetCookieA("http://testing.example.com/foobar"obar", NULL, buffer,
&len);
- ok(ret, "got error %u\n", GetLastError());
- ok(len == 24, "got len %u\n", len);
+ ok(ret, "got error %#x\n", GetLastError());
+ ok(len == 29, "got len %u\n", len);
ok(!!strstr(buffer, "A=B"), "cookie is not present\n");
/* remove persistent cookie */
diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg
index 940797a5151..fb5a002b667 100644
--- a/sdk/tools/winesync/wininet.cfg
+++ b/sdk/tools/winesync/wininet.cfg
@@ -5,4 +5,4 @@ files:
include/wininet.h: sdk/include/psdk/wininet.h
include/winineti.h: sdk/include/psdk/winineti.h
tags:
- wine: d2a1c906dc4979eeabe256f77a58d67290da372d
+ wine: c06e00ee6a15fd77faf66b28edac5e84ad30b550