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]
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);
static bool gdb_accept_tcp(int gdb_fd)
{
- struct sockaddr_in sockaddr;
+ struct sockaddr_in sockaddr = {};
socklen_t len;
int fd;