mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 06:13:46 +08:00
tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs
Zero-initialize sockaddr_in and sockaddr_un structs that we're about to fill in and pass to bind() or connect(), to ensure we don't leave possible implementation-defined extension fields as uninitialized garbage. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20210813150506.7768-5-peter.maydell@linaro.org
This commit is contained in:
parent
a8ca0033c2
commit
baa873f750
@ -251,7 +251,7 @@ static void test_time(void)
|
||||
static int server_socket(void)
|
||||
{
|
||||
int val, fd;
|
||||
struct sockaddr_in sockaddr;
|
||||
struct sockaddr_in sockaddr = {};
|
||||
|
||||
/* server socket */
|
||||
fd = chk_error(socket(PF_INET, SOCK_STREAM, 0));
|
||||
@ -271,7 +271,7 @@ static int server_socket(void)
|
||||
static int client_socket(uint16_t port)
|
||||
{
|
||||
int fd;
|
||||
struct sockaddr_in sockaddr;
|
||||
struct sockaddr_in sockaddr = {};
|
||||
|
||||
/* server socket */
|
||||
fd = chk_error(socket(PF_INET, SOCK_STREAM, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user