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
32724def
Commit
32724def
authored
Oct 07, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Return an error if "out_buff" is NULL for SIO_ADDRESS_LIST_QUERY.
parent
3b1e8bf8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
21 deletions
+23
-21
socket.c
dlls/ws2_32/socket.c
+18
-21
sock.c
dlls/ws2_32/tests/sock.c
+5
-0
No files found.
dlls/ws2_32/socket.c
View file @
32724def
...
@@ -3947,6 +3947,10 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
...
@@ -3947,6 +3947,10 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
if
(
GetAdaptersInfo
(
NULL
,
&
size
)
==
ERROR_BUFFER_OVERFLOW
)
if
(
GetAdaptersInfo
(
NULL
,
&
size
)
==
ERROR_BUFFER_OVERFLOW
)
{
{
IP_ADAPTER_INFO
*
p
,
*
table
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
IP_ADAPTER_INFO
*
p
,
*
table
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
SOCKET_ADDRESS_LIST
*
sa_list
;
SOCKADDR_IN
*
sockaddr
;
SOCKET_ADDRESS
*
sa
;
unsigned
int
i
;
DWORD
num
;
DWORD
num
;
if
(
!
table
||
GetAdaptersInfo
(
table
,
&
size
))
if
(
!
table
||
GetAdaptersInfo
(
table
,
&
size
))
...
@@ -3962,7 +3966,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
...
@@ -3962,7 +3966,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
total
=
sizeof
(
SOCKET_ADDRESS_LIST
)
+
sizeof
(
SOCKET_ADDRESS
)
*
(
num
-
1
);
total
=
sizeof
(
SOCKET_ADDRESS_LIST
)
+
sizeof
(
SOCKET_ADDRESS
)
*
(
num
-
1
);
total
+=
sizeof
(
SOCKADDR
)
*
num
;
total
+=
sizeof
(
SOCKADDR
)
*
num
;
if
(
total
>
out_size
)
if
(
total
>
out_size
||
!
out_buff
)
{
{
*
ret_size
=
total
;
*
ret_size
=
total
;
HeapFree
(
GetProcessHeap
(),
0
,
table
);
HeapFree
(
GetProcessHeap
(),
0
,
table
);
...
@@ -3970,29 +3974,22 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
...
@@ -3970,29 +3974,22 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
break
;
break
;
}
}
if
(
out_buff
)
sa_list
=
out_buff
;
{
sa
=
sa_list
->
Address
;
unsigned
int
i
;
sockaddr
=
(
SOCKADDR_IN
*
)((
char
*
)
sa
+
num
*
sizeof
(
SOCKET_ADDRESS
));
SOCKET_ADDRESS
*
sa
;
sa_list
->
iAddressCount
=
num
;
SOCKET_ADDRESS_LIST
*
sa_list
=
out_buff
;
SOCKADDR_IN
*
sockaddr
;
sa
=
sa_list
->
Address
;
sockaddr
=
(
SOCKADDR_IN
*
)((
char
*
)
sa
+
num
*
sizeof
(
SOCKET_ADDRESS
));
sa_list
->
iAddressCount
=
num
;
for
(
p
=
table
,
i
=
0
;
p
;
p
=
p
->
Next
)
for
(
p
=
table
,
i
=
0
;
p
;
p
=
p
->
Next
)
{
{
if
(
!
p
->
IpAddressList
.
IpAddress
.
String
[
0
])
continue
;
if
(
!
p
->
IpAddressList
.
IpAddress
.
String
[
0
])
continue
;
sa
[
i
].
lpSockaddr
=
(
SOCKADDR
*
)
&
sockaddr
[
i
];
sa
[
i
].
lpSockaddr
=
(
SOCKADDR
*
)
&
sockaddr
[
i
];
sa
[
i
].
iSockaddrLength
=
sizeof
(
SOCKADDR
);
sa
[
i
].
iSockaddrLength
=
sizeof
(
SOCKADDR
);
sockaddr
[
i
].
sin_family
=
AF_INET
;
sockaddr
[
i
].
sin_family
=
AF_INET
;
sockaddr
[
i
].
sin_port
=
0
;
sockaddr
[
i
].
sin_port
=
0
;
sockaddr
[
i
].
sin_addr
.
WS_s_addr
=
inet_addr
(
p
->
IpAddressList
.
IpAddress
.
String
);
sockaddr
[
i
].
sin_addr
.
WS_s_addr
=
inet_addr
(
p
->
IpAddressList
.
IpAddress
.
String
);
i
++
;
i
++
;
}
}
}
HeapFree
(
GetProcessHeap
(),
0
,
table
);
HeapFree
(
GetProcessHeap
(),
0
,
table
);
...
...
dlls/ws2_32/tests/sock.c
View file @
32724def
...
@@ -7499,6 +7499,11 @@ static void test_address_list_query(void)
...
@@ -7499,6 +7499,11 @@ static void test_address_list_query(void)
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"Got unexpected error %d.
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"Got unexpected error %d.
\n
"
,
WSAGetLastError
());
bytes_returned
=
0xdeadbeef
;
bytes_returned
=
0xdeadbeef
;
ret
=
WSAIoctl
(
s
,
SIO_ADDRESS_LIST_QUERY
,
NULL
,
0
,
NULL
,
size
,
&
bytes_returned
,
NULL
,
NULL
);
ok
(
ret
==
SOCKET_ERROR
,
"Got unexpected ret %d.
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"Got unexpected error %d.
\n
"
,
WSAGetLastError
());
ok
(
bytes_returned
==
size
,
"Got unexpected bytes_returned %u, expected %u.
\n
"
,
bytes_returned
,
size
);
ret
=
WSAIoctl
(
s
,
SIO_ADDRESS_LIST_QUERY
,
NULL
,
0
,
address_list
,
1
,
&
bytes_returned
,
NULL
,
NULL
);
ret
=
WSAIoctl
(
s
,
SIO_ADDRESS_LIST_QUERY
,
NULL
,
0
,
address_list
,
1
,
&
bytes_returned
,
NULL
,
NULL
);
ok
(
ret
==
SOCKET_ERROR
,
"Got unexpected ret %d.
\n
"
,
ret
);
ok
(
ret
==
SOCKET_ERROR
,
"Got unexpected ret %d.
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEINVAL
,
"Got unexpected error %d.
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
WSAEINVAL
,
"Got unexpected error %d.
\n
"
,
WSAGetLastError
());
...
...
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