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
9d9e1cc9
Commit
9d9e1cc9
authored
Dec 31, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Dec 31, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Ensure an IPv6 is not recognized as IPv4 in WSAStringToAddress.
parent
127aa62a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
socket.c
dlls/ws2_32/socket.c
+6
-0
sock.c
dlls/ws2_32/tests/sock.c
+14
-0
No files found.
dlls/ws2_32/socket.c
View file @
9d9e1cc9
...
...
@@ -7081,6 +7081,12 @@ INT WINAPI WSAStringToAddressA(LPSTR AddressString,
ptrPort
=
strchr
(
workBuffer
,
':'
);
if
(
ptrPort
)
{
/* User may have entered an IPv6 and asked to parse as IPv4 */
if
(
strchr
(
ptrPort
+
1
,
':'
))
{
res
=
WSAEINVAL
;
break
;
}
((
LPSOCKADDR_IN
)
lpAddress
)
->
sin_port
=
htons
(
atoi
(
ptrPort
+
1
));
*
ptrPort
=
'\0'
;
}
...
...
dlls/ws2_32/tests/sock.c
View file @
9d9e1cc9
...
...
@@ -3010,6 +3010,7 @@ static void test_WSAStringToAddressA(void)
CHAR
address6
[]
=
"::1"
;
CHAR
address7
[]
=
"[::1]"
;
CHAR
address8
[]
=
"[::1]:65535"
;
CHAR
address9
[]
=
"2001::1"
;
len
=
0
;
sockaddr
.
sin_family
=
AF_INET
;
...
...
@@ -3093,6 +3094,12 @@ static void test_WSAStringToAddressA(void)
(
ret
==
SOCKET_ERROR
&&
GLE
==
WSAEINVAL
),
"WSAStringToAddressA() failed for IPv6 address: %d
\n
"
,
GLE
);
len
=
sizeof
(
sockaddr
);
ret
=
WSAStringToAddressA
(
address9
,
AF_INET
,
NULL
,
(
SOCKADDR
*
)
&
sockaddr
,
&
len
);
GLE
=
WSAGetLastError
();
ok
(
(
ret
==
SOCKET_ERROR
&&
GLE
==
WSAEINVAL
),
"WSAStringToAddressA() should have failed with %d
\n
"
,
GLE
);
}
static
void
test_WSAStringToAddressW
(
void
)
...
...
@@ -3113,6 +3120,7 @@ static void test_WSAStringToAddressW(void)
WCHAR
address6
[]
=
{
':'
,
':'
,
'1'
,
'\0'
};
WCHAR
address7
[]
=
{
'['
,
':'
,
':'
,
'1'
,
']'
,
'\0'
};
WCHAR
address8
[]
=
{
'['
,
':'
,
':'
,
'1'
,
']'
,
':'
,
'6'
,
'5'
,
'5'
,
'3'
,
'5'
,
'\0'
};
WCHAR
address9
[]
=
{
'2'
,
'0'
,
'0'
,
'1'
,
':'
,
':'
,
'1'
,
'\0'
};
len
=
0
;
sockaddr
.
sin_family
=
AF_INET
;
...
...
@@ -3209,6 +3217,12 @@ static void test_WSAStringToAddressW(void)
(
ret
==
SOCKET_ERROR
&&
GLE
==
WSAEINVAL
),
"WSAStringToAddressW() failed for IPv6 address: %d
\n
"
,
GLE
);
len
=
sizeof
(
sockaddr
);
ret
=
WSAStringToAddressW
(
address9
,
AF_INET
,
NULL
,
(
SOCKADDR
*
)
&
sockaddr
,
&
len
);
GLE
=
WSAGetLastError
();
ok
(
(
ret
==
SOCKET_ERROR
&&
GLE
==
WSAEINVAL
),
"WSAStringToAddressW() should have failed with %d
\n
"
,
GLE
);
}
static
DWORD
WINAPI
SelectReadThread
(
void
*
param
)
...
...
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