]> Git Repo - qemu.git/commitdiff
gdbstub: Zero-initialize sockaddr structs
authorPeter Maydell <[email protected]>
Fri, 13 Aug 2021 15:05:04 +0000 (16:05 +0100)
committerPeter Maydell <[email protected]>
Thu, 26 Aug 2021 16:02:00 +0000 (17:02 +0100)
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 <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-id: 20210813150506[email protected]

gdbstub.c

index 52bde5bdc9754f40b552be4365dfc39e8cabf15e..5d8e6ae3cd9bbe91d647d8d142a2160ebb10c024 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3218,7 +3218,7 @@ static bool gdb_accept_socket(int gdb_fd)
 
 static int gdbserver_open_socket(const char *path)
 {
-    struct sockaddr_un sockaddr;
+    struct sockaddr_un sockaddr = {};
     int fd, ret;
 
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -3247,7 +3247,7 @@ static int gdbserver_open_socket(const char *path)
 
 static bool gdb_accept_tcp(int gdb_fd)
 {
-    struct sockaddr_in sockaddr;
+    struct sockaddr_in sockaddr = {};
     socklen_t len;
     int fd;
 
This page took 0.033174 seconds and 4 git commands to generate.