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
36649d08
Commit
36649d08
authored
Aug 29, 2018
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsproxy: Fix parameters validation in InternetInitializeAutoProxyDll.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a1e0a029
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
main.c
dlls/jsproxy/main.c
+3
-8
jsproxy.c
dlls/jsproxy/tests/jsproxy.c
+17
-0
No files found.
dlls/jsproxy/main.c
View file @
36649d08
...
@@ -179,20 +179,15 @@ BOOL WINAPI JSPROXY_InternetInitializeAutoProxyDll( DWORD version, LPSTR tmpfile
...
@@ -179,20 +179,15 @@ BOOL WINAPI JSPROXY_InternetInitializeAutoProxyDll( DWORD version, LPSTR tmpfile
if
(
buffer
&&
buffer
->
dwStructSize
==
sizeof
(
*
buffer
)
&&
buffer
->
lpszScriptBuffer
)
if
(
buffer
&&
buffer
->
dwStructSize
==
sizeof
(
*
buffer
)
&&
buffer
->
lpszScriptBuffer
)
{
{
DWORD
i
,
len
=
0
;
if
(
!
buffer
->
dwScriptBufferSize
)
for
(
i
=
0
;
i
<
buffer
->
dwScriptBufferSize
;
i
++
)
{
if
(
!
buffer
->
lpszScriptBuffer
[
i
])
break
;
len
++
;
}
if
(
len
==
buffer
->
dwScriptBufferSize
)
{
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
LeaveCriticalSection
(
&
cs_jsproxy
);
LeaveCriticalSection
(
&
cs_jsproxy
);
return
FALSE
;
return
FALSE
;
}
}
heap_free
(
global_script
->
text
);
heap_free
(
global_script
->
text
);
if
((
global_script
->
text
=
strdupAW
(
buffer
->
lpszScriptBuffer
,
len
)))
ret
=
TRUE
;
if
((
global_script
->
text
=
strdupAW
(
buffer
->
lpszScriptBuffer
,
buffer
->
dwScriptBufferSize
)))
ret
=
TRUE
;
}
}
else
else
{
{
...
...
dlls/jsproxy/tests/jsproxy.c
View file @
36649d08
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "wine/test.h"
#include "wine/test.h"
static
BOOL
old_jsproxy
;
static
BOOL
(
WINAPI
*
pInternetInitializeAutoProxyDll
)
static
BOOL
(
WINAPI
*
pInternetInitializeAutoProxyDll
)
(
DWORD
,
LPSTR
,
LPSTR
,
AutoProxyHelperFunctions
*
,
AUTO_PROXY_SCRIPT_BUFFER
*
);
(
DWORD
,
LPSTR
,
LPSTR
,
AutoProxyHelperFunctions
*
,
AUTO_PROXY_SCRIPT_BUFFER
*
);
static
BOOL
(
WINAPI
*
pInternetDeInitializeAutoProxyDll
)(
LPSTR
,
DWORD
);
static
BOOL
(
WINAPI
*
pInternetDeInitializeAutoProxyDll
)(
LPSTR
,
DWORD
);
...
@@ -34,6 +36,7 @@ static void test_InternetInitializeAutoProxyDll(void)
...
@@ -34,6 +36,7 @@ static void test_InternetInitializeAutoProxyDll(void)
const
char
url
[]
=
"http://localhost"
;
const
char
url
[]
=
"http://localhost"
;
char
script
[]
=
"function FindProxyForURL(url, host) {return
\"
DIRECT
\"
;}
\0
test"
;
char
script
[]
=
"function FindProxyForURL(url, host) {return
\"
DIRECT
\"
;}
\0
test"
;
char
script2
[]
=
"function FindProxyForURL(url, host) {return
\"
PROXY 10.0.0.1:8080
\"
;}
\0
test"
;
char
script2
[]
=
"function FindProxyForURL(url, host) {return
\"
PROXY 10.0.0.1:8080
\"
;}
\0
test"
;
char
script3
[]
=
"function FindProxyForURL(url, host) {return
\"
DIRECT
\"
;}"
;
char
*
proxy
,
host
[]
=
"localhost"
;
char
*
proxy
,
host
[]
=
"localhost"
;
AUTO_PROXY_SCRIPT_BUFFER
buf
;
AUTO_PROXY_SCRIPT_BUFFER
buf
;
DWORD
err
,
len
;
DWORD
err
,
len
;
...
@@ -76,6 +79,16 @@ static void test_InternetInitializeAutoProxyDll(void)
...
@@ -76,6 +79,16 @@ static void test_InternetInitializeAutoProxyDll(void)
ok
(
!
strcmp
(
proxy
,
"PROXY 10.0.0.1:8080"
),
"got
\"
%s
\"\n
"
,
proxy
);
ok
(
!
strcmp
(
proxy
,
"PROXY 10.0.0.1:8080"
),
"got
\"
%s
\"\n
"
,
proxy
);
GlobalFree
(
proxy
);
GlobalFree
(
proxy
);
buf
.
lpszScriptBuffer
=
script3
;
buf
.
dwScriptBufferSize
=
strlen
(
script3
);
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
ok
(
ret
||
broken
(
old_jsproxy
&&
!
ret
),
"got %u
\n
"
,
GetLastError
()
);
buf
.
dwScriptBufferSize
=
1
;
script3
[
0
]
=
0
;
ret
=
pInternetInitializeAutoProxyDll
(
0
,
NULL
,
NULL
,
NULL
,
&
buf
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ret
=
pInternetDeInitializeAutoProxyDll
(
NULL
,
0
);
ret
=
pInternetDeInitializeAutoProxyDll
(
NULL
,
0
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
()
);
}
}
...
@@ -150,6 +163,10 @@ START_TEST(jsproxy)
...
@@ -150,6 +163,10 @@ START_TEST(jsproxy)
return
;
return
;
}
}
old_jsproxy
=
!
GetProcAddress
(
module
,
"InternetGetProxyInfoEx"
);
if
(
old_jsproxy
)
trace
(
"InternetGetProxyInfoEx not available
\n
"
);
test_InternetInitializeAutoProxyDll
();
test_InternetInitializeAutoProxyDll
();
test_InternetGetProxyInfo
();
test_InternetGetProxyInfo
();
}
}
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