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
c84e416d
Commit
c84e416d
authored
May 20, 2020
by
Alex Henrie
Committed by
Alexandre Julliard
May 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Don't set output length in WSAStringToAddress on error.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
205e09bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
socket.c
dlls/ws2_32/socket.c
+2
-2
sock.c
dlls/ws2_32/tests/sock.c
+15
-5
No files found.
dlls/ws2_32/socket.c
View file @
c84e416d
...
...
@@ -8514,7 +8514,6 @@ INT WINAPI WSAStringToAddressA(LPSTR AddressString,
res
=
WSAEFAULT
;
break
;
}
*
lpAddressLength
=
sizeof
(
SOCKADDR_IN
);
memset
(
lpAddress
,
0
,
sizeof
(
SOCKADDR_IN
));
status
=
RtlIpv4StringToAddressExA
(
AddressString
,
FALSE
,
&
addr4
->
sin_addr
,
&
addr4
->
sin_port
);
...
...
@@ -8524,6 +8523,7 @@ INT WINAPI WSAStringToAddressA(LPSTR AddressString,
break
;
}
addr4
->
sin_family
=
WS_AF_INET
;
*
lpAddressLength
=
sizeof
(
SOCKADDR_IN
);
break
;
}
case
WS_AF_INET6
:
...
...
@@ -8537,7 +8537,6 @@ INT WINAPI WSAStringToAddressA(LPSTR AddressString,
res
=
WSAEFAULT
;
break
;
}
*
lpAddressLength
=
sizeof
(
SOCKADDR_IN6
);
memset
(
lpAddress
,
0
,
sizeof
(
SOCKADDR_IN6
));
status
=
RtlIpv6StringToAddressExA
(
AddressString
,
&
addr6
->
sin6_addr
,
&
addr6
->
sin6_scope_id
,
&
addr6
->
sin6_port
);
...
...
@@ -8547,6 +8546,7 @@ INT WINAPI WSAStringToAddressA(LPSTR AddressString,
break
;
}
addr6
->
sin6_family
=
WS_AF_INET6
;
*
lpAddressLength
=
sizeof
(
SOCKADDR_IN6
);
break
;
}
default:
...
...
dlls/ws2_32/tests/sock.c
View file @
c84e416d
...
...
@@ -3454,7 +3454,7 @@ static void test_WSAStringToAddress(void)
};
WCHAR
inputW
[
64
];
INT
len
,
ret
,
expected_ret
;
INT
len
,
ret
,
expected_
len
,
expected_
ret
;
short
expected_family
;
SOCKADDR_IN
sockaddr
;
SOCKADDR_IN6
sockaddr6
;
...
...
@@ -3465,13 +3465,16 @@ static void test_WSAStringToAddress(void)
ret
=
WSAStringToAddressA
(
ipv4_tests
[
0
].
input
,
AF_INET
,
NULL
,
(
SOCKADDR
*
)
&
sockaddr
,
&
len
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAStringToAddressA() returned %d, expected SOCKET_ERROR
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"WSAStringToAddress() gave error %d, expected WSAEFAULT
\n
"
,
WSAGetLastError
()
);
ok
(
len
>=
sizeof
(
sockaddr
)
||
broken
(
len
==
0
)
/* xp */
,
"WSAStringToAddress() gave length %d, expected at least %d
\n
"
,
len
,
sizeof
(
sockaddr
)
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
ipv4_tests
);
j
++
)
{
len
=
sizeof
(
sockaddr
);
memset
(
&
sockaddr
,
0xab
,
len
);
len
=
sizeof
(
sockaddr
)
+
10
;
expected_len
=
ipv4_tests
[
j
].
error
?
len
:
sizeof
(
sockaddr
);
memset
(
&
sockaddr
,
0xab
,
sizeof
(
sockaddr
)
);
WSASetLastError
(
0
);
if
(
i
==
0
)
...
...
@@ -3500,12 +3503,16 @@ static void test_WSAStringToAddress(void)
ok
(
sockaddr
.
sin_port
==
ipv4_tests
[
j
].
port
,
"WSAStringToAddress(%s) gave port %04x, expected %04x
\n
"
,
wine_dbgstr_a
(
ipv4_tests
[
j
].
input
),
sockaddr
.
sin_port
,
ipv4_tests
[
j
].
port
);
ok
(
len
==
expected_len
,
"WSAStringToAddress(%s) gave length %d, expected %d
\n
"
,
wine_dbgstr_a
(
ipv4_tests
[
j
].
input
),
len
,
expected_len
);
}
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
ipv6_tests
);
j
++
)
{
len
=
sizeof
(
sockaddr6
);
memset
(
&
sockaddr6
,
0xab
,
len
);
len
=
sizeof
(
sockaddr6
)
+
10
;
expected_len
=
ipv6_tests
[
j
].
error
?
len
:
sizeof
(
sockaddr6
);
memset
(
&
sockaddr6
,
0xab
,
sizeof
(
sockaddr6
)
);
WSASetLastError
(
0
);
if
(
i
==
0
)
...
...
@@ -3553,6 +3560,9 @@ static void test_WSAStringToAddress(void)
ok
(
sockaddr6
.
sin6_flowinfo
==
0
,
"WSAStringToAddress(%s) gave flowinfo %d, expected 0
\n
"
,
wine_dbgstr_a
(
ipv6_tests
[
j
].
input
),
sockaddr6
.
sin6_flowinfo
);
ok
(
len
==
expected_len
,
"WSAStringToAddress(%s) gave length %d, expected %d
\n
"
,
wine_dbgstr_a
(
ipv6_tests
[
j
].
input
),
len
,
expected_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