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
542998ee
Commit
542998ee
authored
Jan 27, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Accept NULL buffer for size queries in WinHttpCreateUrl.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f2c00546
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
url.c
dlls/winhttp/tests/url.c
+19
-8
url.c
dlls/winhttp/url.c
+6
-2
No files found.
dlls/winhttp/tests/url.c
View file @
542998ee
...
...
@@ -118,7 +118,7 @@ static void WinHttpCreateUrl_test( void )
{
URL_COMPONENTS
uc
;
WCHAR
*
url
;
DWORD
len
;
DWORD
len
,
err
;
BOOL
ret
;
/* NULL components */
...
...
@@ -144,22 +144,33 @@ static void WinHttpCreateUrl_test( void )
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
GetLastError
()
);
/* valid components, NULL url */
/* valid components, NULL url, insufficient length */
len
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpCreateUrl
(
&
uc
,
0
,
NULL
,
&
len
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
||
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER got %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER got %u
\n
"
,
GetLastError
()
);
ok
(
len
==
57
,
"expected len 57 got %u
\n
"
,
len
);
/* valid components, NULL url, sufficient length */
SetLastError
(
0xdeadbeef
);
len
=
256
;
ret
=
WinHttpCreateUrl
(
&
uc
,
0
,
NULL
,
&
len
);
err
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
err
==
ERROR_INVALID_PARAMETER
||
broken
(
err
==
ERROR_INSUFFICIENT_BUFFER
)
/* < win7 */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
GetLastError
()
);
ok
(
len
==
256
||
broken
(
len
==
57
)
/* < win7 */
,
"expected len 256 got %u
\n
"
,
len
);
/* correct size, NULL url */
fill_url_components
(
&
uc
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpCreateUrl
(
&
uc
,
0
,
NULL
,
&
len
);
err
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
||
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER got %u
\n
"
,
GetLastError
()
);
ok
(
err
==
ERROR_INVALID_PARAMETER
||
broken
(
err
==
ERROR_INSUFFICIENT_BUFFER
)
/* < win7 */
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
GetLastError
()
);
ok
(
len
==
256
||
broken
(
len
==
57
)
/* < win7 */
,
"expected len 256 got %u
\n
"
,
len
);
/* valid components, allocated url, short length */
SetLastError
(
0xdeadbeef
);
...
...
dlls/winhttp/url.c
View file @
542998ee
...
...
@@ -417,13 +417,12 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
{
static
const
WCHAR
formatW
[]
=
{
'%'
,
'u'
,
0
};
static
const
WCHAR
twoslashW
[]
=
{
'/'
,
'/'
};
DWORD
len
;
INTERNET_SCHEME
scheme
;
TRACE
(
"%p, 0x%08x, %p, %p
\n
"
,
uc
,
flags
,
url
,
required
);
if
(
!
uc
||
uc
->
dwStructSize
!=
sizeof
(
URL_COMPONENTS
)
||
!
required
||
!
url
)
if
(
!
uc
||
uc
->
dwStructSize
!=
sizeof
(
URL_COMPONENTS
)
||
!
required
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
...
...
@@ -437,6 +436,11 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
set_last_error
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
if
(
!
url
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
url
[
0
]
=
0
;
*
required
=
len
;
...
...
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