Skip to content

Commit fdcdf54

Browse files
committed
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 <[email protected]> Reviewed-by: Eric Blake <[email protected]> Message-id: [email protected]
1 parent 5929238 commit fdcdf54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gdbstub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,7 +3218,7 @@ static bool gdb_accept_socket(int gdb_fd)
32183218

32193219
static int gdbserver_open_socket(const char *path)
32203220
{
3221-
struct sockaddr_un sockaddr;
3221+
struct sockaddr_un sockaddr = {};
32223222
int fd, ret;
32233223

32243224
fd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -3247,7 +3247,7 @@ static int gdbserver_open_socket(const char *path)
32473247

32483248
static bool gdb_accept_tcp(int gdb_fd)
32493249
{
3250-
struct sockaddr_in sockaddr;
3250+
struct sockaddr_in sockaddr = {};
32513251
socklen_t len;
32523252
int fd;
32533253

0 commit comments

Comments
 (0)