Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f877fe9b
Commit
f877fe9b
authored
Dec 27, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Properly handle output buffer size in InternetGetCookieA.
parent
0c02e358
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
cookie.c
dlls/wininet/cookie.c
+13
-3
internet.c
dlls/wininet/tests/internet.c
+7
-0
No files found.
dlls/wininet/cookie.c
View file @
f877fe9b
...
...
@@ -678,7 +678,7 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
LPSTR
lpCookieData
,
LPDWORD
lpdwSize
)
{
WCHAR
*
url
,
*
name
;
DWORD
len
;
DWORD
len
,
size
;
BOOL
r
;
TRACE
(
"(%s %s %p %p(%u))
\n
"
,
debugstr_a
(
lpszUrl
),
debugstr_a
(
lpszCookieName
),
...
...
@@ -701,8 +701,18 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
{
r
=
InternetGetCookieW
(
url
,
name
,
szCookieData
,
&
len
);
*
lpdwSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szCookieData
,
len
,
lpCookieData
,
lpCookieData
?
*
lpdwSize
:
0
,
NULL
,
NULL
);
if
(
r
)
{
size
=
WideCharToMultiByte
(
CP_ACP
,
0
,
szCookieData
,
len
,
NULL
,
0
,
NULL
,
NULL
);
if
(
lpCookieData
)
{
if
(
*
lpdwSize
>=
size
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
szCookieData
,
len
,
lpCookieData
,
*
lpdwSize
,
NULL
,
NULL
);
}
else
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
r
=
FALSE
;
}
}
*
lpdwSize
=
size
;
}
heap_free
(
szCookieData
);
}
...
...
dlls/wininet/tests/internet.c
View file @
f877fe9b
...
...
@@ -414,6 +414,13 @@ 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
"
);
len
=
10
;
memset
(
buffer
,
0xac
,
sizeof
(
buffer
));
ret
=
InternetGetCookie
(
"http://testing.example.com"
,
NULL
,
buffer
,
&
len
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"InternetGetCookie returned: %x(%u), expected ERROR_INSUFFICIENT_BUFFER
\n
"
,
ret
,
GetLastError
());
ok
(
len
==
19
,
"len = %u
\n
"
,
len
);
len
=
1024
;
ret
=
InternetGetCookieW
(
testing_example_comW
,
NULL
,
NULL
,
&
len
);
ok
(
ret
==
TRUE
,
"InternetGetCookieW failed
\n
"
);
...
...
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