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
d35c13c6
Commit
d35c13c6
authored
Nov 12, 2007
by
Kai Blin
Committed by
Alexandre Julliard
Nov 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Cope with buggy apps passing setsockopt optval as a value instead of a pointer.
parent
0fade3c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
socket.c
dlls/ws2_32/socket.c
+7
-0
sock.c
dlls/ws2_32/tests/sock.c
+10
-1
No files found.
dlls/ws2_32/socket.c
View file @
d35c13c6
...
...
@@ -2812,6 +2812,13 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
TRACE
(
"socket: %04lx, level 0x%x, name 0x%x, ptr %p, len %d
\n
"
,
s
,
level
,
optname
,
optval
,
optlen
);
/* some broken apps pass the value directly instead of a pointer to it */
if
(
IS_INTRESOURCE
(
optval
))
{
SetLastError
(
WSAEFAULT
);
return
SOCKET_ERROR
;
}
switch
(
level
)
{
case
WS_SOL_SOCKET
:
...
...
dlls/ws2_32/tests/sock.c
View file @
d35c13c6
...
...
@@ -850,7 +850,7 @@ LINGER linger_testvals[] = {
static
void
test_set_getsockopt
(
void
)
{
SOCKET
s
;
int
i
,
err
;
int
i
,
err
,
lasterr
;
int
timeout
;
LINGER
lingval
;
int
size
;
...
...
@@ -889,6 +889,15 @@ static void test_set_getsockopt(void)
lingval
.
l_onoff
,
lingval
.
l_linger
,
linger_testvals
[
i
].
l_onoff
,
linger_testvals
[
i
].
l_linger
);
}
/* Test for erroneously passing a value instead of a pointer as optval */
size
=
sizeof
(
char
);
err
=
setsockopt
(
s
,
SOL_SOCKET
,
SO_DONTROUTE
,
(
char
*
)
1
,
size
);
ok
(
err
==
SOCKET_ERROR
,
"setsockopt with optval being a value passed "
"instead of failing.
\n
"
);
lasterr
=
WSAGetLastError
();
ok
(
lasterr
==
WSAEFAULT
,
"setsockopt with optval being a value "
"returned 0x%08x, not WSAEFAULT(0x%08x)
\n
"
,
lasterr
,
WSAEFAULT
);
closesocket
(
s
);
}
...
...
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