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
6055c667
Commit
6055c667
authored
Dec 20, 2006
by
Kai Blin
Committed by
Alexandre Julliard
Dec 20, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: ws_sockaddr_u2ws should zero the sockaddr_in.sin_zero field.
parent
80cff47c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
socket.c
dlls/ws2_32/socket.c
+1
-0
sock.c
dlls/ws2_32/tests/sock.c
+48
-0
No files found.
dlls/ws2_32/socket.c
View file @
6055c667
...
@@ -1017,6 +1017,7 @@ static int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, struct W
...
@@ -1017,6 +1017,7 @@ static int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, struct W
win
->
sin_family
=
WS_AF_INET
;
win
->
sin_family
=
WS_AF_INET
;
win
->
sin_port
=
uin
->
sin_port
;
win
->
sin_port
=
uin
->
sin_port
;
memcpy
(
&
win
->
sin_addr
,
&
uin
->
sin_addr
,
4
);
/* 4 bytes = 32 address bits */
memcpy
(
&
win
->
sin_addr
,
&
uin
->
sin_addr
,
4
);
/* 4 bytes = 32 address bits */
memset
(
&
win
->
sin_zero
,
0
,
8
);
/* Make sure the null padding is null */
*
wsaddrlen
=
sizeof
(
struct
WS_sockaddr_in
);
*
wsaddrlen
=
sizeof
(
struct
WS_sockaddr_in
);
return
0
;
return
0
;
}
}
...
...
dlls/ws2_32/tests/sock.c
View file @
6055c667
...
@@ -1565,6 +1565,53 @@ static void test_extendedSocketOptions()
...
@@ -1565,6 +1565,53 @@ static void test_extendedSocketOptions()
WSACleanup
();
WSACleanup
();
}
}
static
void
test_getsockname
()
{
WSADATA
wsa
;
SOCKET
sock
;
struct
sockaddr_in
sa_set
,
sa_get
;
int
sa_set_len
=
sizeof
(
struct
sockaddr_in
);
int
sa_get_len
=
sa_set_len
;
static
const
unsigned
char
null_padding
[]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
if
(
WSAStartup
(
MAKEWORD
(
2
,
0
),
&
wsa
)){
trace
(
"Winsock failed: 0x%08x. Aborting test
\n
"
,
WSAGetLastError
());
return
;
}
memset
(
&
sa_set
,
0
,
sa_set_len
);
sa_set
.
sin_family
=
AF_INET
;
sa_set
.
sin_port
=
htons
(
0
);
sa_set
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
((
sock
=
socket
(
PF_INET
,
SOCK_STREAM
,
IPPROTO_IP
))
<
0
){
trace
(
"Creating the socket failed: 0x%08x
\n
"
,
WSAGetLastError
());
WSACleanup
();
return
;
}
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
sa_set
,
sa_set_len
)
<
0
){
trace
(
"Failed to bind socket: 0x%08x
\n
"
,
WSAGetLastError
());
closesocket
(
sock
);
WSACleanup
();
return
;
}
if
(
getsockname
(
sock
,
(
struct
sockaddr
*
)
&
sa_get
,
&
sa_get_len
)
!=
0
){
trace
(
"Failed to call getsockname: 0x%08X
\n
"
,
WSAGetLastError
());
closesocket
(
sock
);
WSACleanup
();
return
;
}
ok
(
memcmp
(
sa_get
.
sin_zero
,
null_padding
,
8
)
==
0
,
"getsockname did not zero the sockaddr_in structure
\n
"
);
closesocket
(
sock
);
WSACleanup
();
}
/**************** Main program ***************/
/**************** Main program ***************/
START_TEST
(
sock
)
START_TEST
(
sock
)
...
@@ -1595,6 +1642,7 @@ START_TEST( sock )
...
@@ -1595,6 +1642,7 @@ START_TEST( sock )
test_select
();
test_select
();
test_accept
();
test_accept
();
test_getsockname
();
Exit
();
Exit
();
}
}
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