aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJindrich Novy <jnovy@redhat.com>2020-05-27 11:18:36 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-05-27 12:38:54 +0200
commitb0fc01a6b8cf6a50a1af69845cca692cc42dd970 (patch)
treeb97a74e401e2c319a323bb7d8c50e87eba89806c
parent2d79c0b7d78e55624790a102fbd924a4259eef16 (diff)
downloadslirp-b0fc01a6b8cf6a50a1af69845cca692cc42dd970.zip
slirp-b0fc01a6b8cf6a50a1af69845cca692cc42dd970.tar.gz
slirp-b0fc01a6b8cf6a50a1af69845cca692cc42dd970.tar.bz2
Be sure to initialize sockaddr structure
Error: UNINIT (CWE-457): [#def30] libslirp-4.3.0/src/udp.c:325: var_decl: Declaring variable "addr" without initializer. libslirp-4.3.0/src/udp.c:342: uninit_use_in_call: Using uninitialized value "addr". Field "addr.sin_zero" is uninitialized when calling "bind". Signed-off-by: Jindrich Novy <jnovy@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r--src/udp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/udp.c b/src/udp.c
index 9ed1e74..0ad44d7 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -329,6 +329,7 @@ struct socket *udp_listen(Slirp *slirp, uint32_t haddr, unsigned hport,
struct socket *so;
socklen_t addrlen = sizeof(struct sockaddr_in);
+ memset(&addr, 0, sizeof(addr));
so = socreate(slirp);
so->s = slirp_socket(AF_INET, SOCK_DGRAM, 0);
if (so->s < 0) {