tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 13 Aug 2021 15:05:05 +0000 (16:05 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 26 Aug 2021 16:02:00 +0000 (17:02 +0100)
Zero-initialize the sockaddr_in struct that we're about to fill in
and pass to bind(), 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>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-id: 20210813150506.7768-4-peter.maydell@linaro.org

tests/qtest/ipmi-bt-test.c

index 8492f02a9c3db02f9bb7da770cae14b22a1d3ce4..19612e9405aed708a8d1b87907050a231e363fa2 100644 (file)
@@ -378,7 +378,7 @@ static void test_enable_irq(void)
  */
 static void open_socket(void)
 {
-    struct sockaddr_in myaddr;
+    struct sockaddr_in myaddr = {};
     socklen_t addrlen;
 
     myaddr.sin_family = AF_INET;