Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
21e7e28d
Commit
21e7e28d
authored
Dec 03, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Fixed NULL cookie data pointer handling in InternetGetCookieA.
parent
ed42609f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
5 deletions
+39
-5
cookie.c
dlls/wininet/cookie.c
+8
-5
internet.c
dlls/wininet/tests/internet.c
+31
-0
No files found.
dlls/wininet/cookie.c
View file @
21e7e28d
...
...
@@ -657,12 +657,12 @@ BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
BOOL
WINAPI
InternetGetCookieA
(
LPCSTR
lpszUrl
,
LPCSTR
lpszCookieName
,
LPSTR
lpCookieData
,
LPDWORD
lpdwSize
)
{
WCHAR
*
url
,
*
name
;
DWORD
len
;
LPWSTR
szCookieData
=
NULL
,
url
,
name
;
BOOL
r
;
TRACE
(
"(%s
,%s,%p
)
\n
"
,
debugstr_a
(
lpszUrl
),
debugstr_a
(
lpszCookieName
),
lpCookieData
);
TRACE
(
"(%s
%s %p %p(%u)
)
\n
"
,
debugstr_a
(
lpszUrl
),
debugstr_a
(
lpszCookieName
),
lpCookieData
,
lpdwSize
,
lpdwSize
?
*
lpdwSize
:
0
);
url
=
heap_strdupAtoW
(
lpszUrl
);
name
=
heap_strdupAtoW
(
lpszCookieName
);
...
...
@@ -670,6 +670,8 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
r
=
InternetGetCookieW
(
url
,
name
,
NULL
,
&
len
);
if
(
r
)
{
WCHAR
*
szCookieData
;
szCookieData
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
if
(
!
szCookieData
)
{
...
...
@@ -680,10 +682,11 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
r
=
InternetGetCookieW
(
url
,
name
,
szCookieData
,
&
len
);
*
lpdwSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szCookieData
,
len
,
lpCookieData
,
*
lpdwSize
,
NULL
,
NULL
);
lpCookieData
,
lpCookieData
?
*
lpdwSize
:
0
,
NULL
,
NULL
);
heap_free
(
szCookieData
);
}
}
heap_free
(
szCookieData
);
heap_free
(
name
);
heap_free
(
url
);
return
r
;
...
...
dlls/wininet/tests/internet.c
View file @
21e7e28d
...
...
@@ -370,6 +370,10 @@ static void test_complicated_cookie(void)
CHAR
buffer
[
1024
];
CHAR
user
[
256
];
WCHAR
wbuf
[
1024
];
static
const
WCHAR
testing_example_comW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
't'
,
'e'
,
's'
,
't'
,
'i'
,
'n'
,
'g'
,
'.'
,
'e'
,
'x'
,
'a'
,
'm'
,
'p'
,
'l'
,
'e'
,
'.'
,
'c'
,
'o'
,
'm'
,
0
};
ret
=
InternetSetCookie
(
"http://www.example.com/bar"
,
NULL
,
"A=B; domain=.example.com"
);
ok
(
ret
==
TRUE
,
"InternetSetCookie failed
\n
"
);
...
...
@@ -391,8 +395,16 @@ static void test_complicated_cookie(void)
ok
(
ret
==
TRUE
,
"InternetSetCookie failed
\n
"
);
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com"
,
NULL
,
NULL
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookie failed
\n
"
);
ok
(
len
==
19
,
"len = %u
\n
"
,
len
);
len
=
1024
;
memset
(
buffer
,
0xac
,
sizeof
(
buffer
));
ret
=
InternetGetCookie
(
"http://testing.example.com"
,
NULL
,
buffer
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookie failed
\n
"
);
ok
(
len
==
19
,
"len = %u
\n
"
,
len
);
ok
(
strlen
(
buffer
)
==
18
,
"strlen(buffer) = %u
\n
"
,
lstrlenA
(
buffer
));
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
"
);
...
...
@@ -403,6 +415,18 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
len
=
1024
;
ret
=
InternetGetCookieW
(
testing_example_comW
,
NULL
,
NULL
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookieW failed
\n
"
);
ok
(
len
==
38
,
"len = %u
\n
"
,
len
);
len
=
1024
;
memset
(
wbuf
,
0xac
,
sizeof
(
wbuf
));
ret
=
InternetGetCookieW
(
testing_example_comW
,
NULL
,
wbuf
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookieW failed
\n
"
);
ok
(
len
==
19
,
"len = %u
\n
"
,
len
);
ok
(
lstrlenW
(
wbuf
)
==
18
,
"strlenW(wbuf) = %u
\n
"
,
lstrlenW
(
wbuf
));
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/foobar"
,
NULL
,
buffer
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookie failed
\n
"
);
ok
(
strstr
(
buffer
,
"A=B"
)
!=
NULL
,
"A=B missing
\n
"
);
...
...
@@ -465,6 +489,7 @@ static void test_complicated_cookie(void)
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/bar/foo"
,
NULL
,
buffer
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookie failed
\n
"
);
ok
(
len
==
24
,
"len = %u
\n
"
,
24
);
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
"
);
...
...
@@ -474,6 +499,12 @@ static void test_complicated_cookie(void)
ok
(
strstr
(
buffer
,
"M=N"
)
==
NULL
,
"M=N present
\n
"
);
ok
(
strstr
(
buffer
,
"O=P"
)
==
NULL
,
"O=P present
\n
"
);
/* Cookie name argument is not implemented */
len
=
1024
;
ret
=
InternetGetCookie
(
"http://testing.example.com/bar/foo"
,
"A"
,
buffer
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookie failed
\n
"
);
ok
(
len
==
24
,
"len = %u
\n
"
,
24
);
/* test persistent cookies */
ret
=
InternetSetCookie
(
"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
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment