Fix: missing addrlen initialization before accept(2)
authorDavid Goulet <dgoulet@efficios.com>
Fri, 26 Oct 2012 15:48:19 +0000 (11:48 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 26 Oct 2012 15:48:19 +0000 (11:48 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/sessiond-comm/inet.c
src/common/sessiond-comm/inet6.c

index e8d3afef316696ebdef315e92e58870f5c784c52..f9ea17dbf975b246448e463b69ff64978745c9bc 100644 (file)
@@ -129,7 +129,7 @@ __attribute__((visibility("hidden")))
 struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
 {
        int new_fd;
-       socklen_t len = 0;
+       socklen_t len;
        struct lttcomm_sock *new_sock;
 
        if (sock->proto == LTTCOMM_SOCK_UDP) {
@@ -145,6 +145,8 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
                goto error;
        }
 
+       len = sizeof(new_sock->sockaddr.addr.sin);
+
        /* Blocking call */
        new_fd = accept(sock->fd, (struct sockaddr *) &new_sock->sockaddr.addr.sin,
                        &len);
index 8fe0276013bce4b0f6e613b6230d55b377ffe58f..024beace3bed4ff8dc704936317ebc546540a1b9 100644 (file)
@@ -129,7 +129,7 @@ __attribute__((visibility("hidden")))
 struct lttcomm_sock *lttcomm_accept_inet6_sock(struct lttcomm_sock *sock)
 {
        int new_fd;
-       socklen_t len = 0;
+       socklen_t len;
        struct lttcomm_sock *new_sock;
 
        if (sock->proto == LTTCOMM_SOCK_UDP) {
@@ -145,6 +145,8 @@ struct lttcomm_sock *lttcomm_accept_inet6_sock(struct lttcomm_sock *sock)
                goto error;
        }
 
+       len = sizeof(new_sock->sockaddr.addr.sin6);
+
        /* Blocking call */
        new_fd = accept(sock->fd,
                        (struct sockaddr *) &new_sock->sockaddr.addr.sin6, &len);
This page took 0.030049 seconds and 4 git commands to generate.