aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-08-13 16:05:06 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-08-26 17:02:00 +0100
commitbaa873f7508df9f622c9d1ed43d3a03c9cce785c (patch)
treea55b948ae881c3145ee3e0883c691c13009da94d /tests/tcg/multiarch
parenta8ca0033c25939d609c1bab12f6b8402ff719552 (diff)
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
Diffstat (limited to 'tests/tcg/multiarch')
-rw-r--r--tests/tcg/multiarch/linux-test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
index c8c6aeddeb..019d8175ca 100644
--- a/tests/tcg/multiarch/linux-test.c
+++ b/tests/tcg/multiarch/linux-test.c
@@ -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));