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
15978ddc
Commit
15978ddc
authored
Sep 10, 2008
by
Jeff Zaroyko
Committed by
Alexandre Julliard
Sep 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: ioctlsocket should try to check if argp is valid.
parent
12c1e067
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
socket.c
dlls/ws2_32/socket.c
+6
-0
sock.c
dlls/ws2_32/tests/sock.c
+27
-0
No files found.
dlls/ws2_32/socket.c
View file @
15978ddc
...
...
@@ -2345,6 +2345,12 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
long
newcmd
=
cmd
;
TRACE
(
"socket %04lx, cmd %08x, ptr %p
\n
"
,
s
,
cmd
,
argp
);
/* broken apps like defcon pass the argp value directly instead of a pointer to it */
if
(
IS_INTRESOURCE
(
argp
))
{
SetLastError
(
WSAEFAULT
);
return
SOCKET_ERROR
;
}
switch
(
cmd
)
{
...
...
dlls/ws2_32/tests/sock.c
View file @
15978ddc
...
...
@@ -3,6 +3,7 @@
*
* Copyright 2002 Martin Wilck
* Copyright 2005 Thomas Kho
* Copyright 2008 Jeff Zaroyko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -1989,6 +1990,31 @@ static void test_inet_addr(void)
ok
(
addr
==
INADDR_NONE
,
"inet_addr succeeded unexpectedly
\n
"
);
}
static
void
test_ioctlsocket
(
void
)
{
SOCKET
sock
;
int
ret
;
long
cmds
[]
=
{
FIONBIO
,
FIONREAD
,
SIOCATMARK
};
int
i
;
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ok
(
sock
!=
INVALID_SOCKET
,
"Creating the socket failed: %d
\n
"
,
WSAGetLastError
());
if
(
sock
==
INVALID_SOCKET
)
{
skip
(
"Can't continue without a socket.
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
cmds
)
/
sizeof
(
long
);
i
++
)
{
/* broken apps like defcon pass the argp value directly instead of a pointer to it */
ret
=
ioctlsocket
(
sock
,
cmds
[
i
],
(
u_long
*
)
1
);
ok
(
ret
==
SOCKET_ERROR
,
"ioctlsocket succeeded unexpectedly
\n
"
);
ret
=
WSAGetLastError
();
ok
(
ret
==
WSAEFAULT
,
"expected WSAEFAULT, got %d instead
\n
"
,
ret
);
}
}
static
DWORD
WINAPI
drain_socket_thread
(
LPVOID
arg
)
{
char
buffer
[
1024
];
...
...
@@ -2304,6 +2330,7 @@ START_TEST( sock )
test_accept
();
test_getsockname
();
test_inet_addr
();
test_ioctlsocket
();
test_dns
();
test_gethostbyname_hack
();
...
...
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