aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-08-13 16:05:04 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-08-26 17:02:00 +0100
commitfdcdf54d1e93792c66e7566cec4638786990174e (patch)
treef896f663834b22a5a21b7db532070aeffb6cbb5e /gdbstub.c
parent59292384621e93f707f862b6936694e56a6daed0 (diff)
gdbstub: 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-3-peter.maydell@linaro.org
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 52bde5bdc9..5d8e6ae3cd 100644
--- 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;