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
e7dc8237
Commit
e7dc8237
authored
Jan 20, 2021
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Avoid returning duplicate entries from WS_getaddrinfo.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9c11fc64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
socket.c
dlls/ws2_32/socket.c
+27
-1
No files found.
dlls/ws2_32/socket.c
View file @
e7dc8237
...
...
@@ -6528,6 +6528,21 @@ static char *get_fqdn(void)
return
ret
;
}
static
BOOL
addrinfo_in_list
(
const
struct
WS_addrinfo
*
list
,
const
struct
WS_addrinfo
*
ai
)
{
const
struct
WS_addrinfo
*
cursor
=
list
;
while
(
cursor
)
{
if
(
ai
->
ai_flags
==
cursor
->
ai_flags
&&
ai
->
ai_family
==
cursor
->
ai_family
&&
ai
->
ai_socktype
==
cursor
->
ai_socktype
&&
ai
->
ai_protocol
==
cursor
->
ai_protocol
&&
ai
->
ai_addrlen
==
cursor
->
ai_addrlen
&&
!
memcmp
(
ai
->
ai_addr
,
cursor
->
ai_addr
,
ai
->
ai_addrlen
)
&&
((
ai
->
ai_canonname
&&
cursor
->
ai_canonname
&&
!
strcmp
(
ai
->
ai_canonname
,
cursor
->
ai_canonname
))
||
(
!
ai
->
ai_canonname
&&
!
cursor
->
ai_canonname
)))
return
TRUE
;
cursor
=
cursor
->
ai_next
;
}
return
FALSE
;
}
/***********************************************************************
* getaddrinfo (WS2_32.@)
*/
...
...
@@ -6654,7 +6669,6 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
if
(
!
ai
)
goto
outofmem
;
*
xai
=
ai
;
xai
=
&
ai
->
ai_next
;
ai
->
ai_flags
=
convert_aiflag_u2w
(
xuai
->
ai_flags
);
ai
->
ai_family
=
convert_af_u2w
(
xuai
->
ai_family
);
/* copy whatever was sent in the hints */
...
...
@@ -6690,6 +6704,18 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
goto
outofmem
;
ai
->
ai_addrlen
=
len
;
}
while
(
1
);
if
(
addrinfo_in_list
(
*
res
,
ai
))
{
HeapFree
(
GetProcessHeap
(),
0
,
ai
->
ai_canonname
);
HeapFree
(
GetProcessHeap
(),
0
,
ai
->
ai_addr
);
HeapFree
(
GetProcessHeap
(),
0
,
ai
);
}
else
{
*
xai
=
ai
;
xai
=
&
ai
->
ai_next
;
}
xuai
=
xuai
->
ai_next
;
}
freeaddrinfo
(
unixaires
);
...
...
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