summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-05-14 22:51:11 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-05-14 22:51:11 +0000
commitb0151710a8127f566d4d1dde35c9896e0938e025 (patch)
tree2d5fe513ecfa7d22b80708450f5e7332eeb28d78
parent0094809955895c974fbe95f2d3ed13f420a6a6ed (diff)
Initialize sockaddr variables before using them.
-rw-r--r--common/glib-helper.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/glib-helper.c b/common/glib-helper.c
index 69b23d4c..d43a3cf7 100644
--- a/common/glib-helper.c
+++ b/common/glib-helper.c
@@ -376,11 +376,13 @@ static inline int resolve_names(int fd, struct sockaddr *host,
socklen_t namelen;
namelen = len;
+ memset(host, 0, len);
err = getsockname(fd, host, &namelen);
if (err < 0)
return err;
namelen = len;
+ memset(peer, 0, len);
err = getpeername(fd, peer, &namelen);
if (err < 0)
return err;
@@ -462,6 +464,7 @@ static gboolean listen_cb(GIOChannel *chan, GIOCondition cond,
}
len = sizeof(addr);
+ memset(&addr, 0, len);
fd = accept(io_ctxt->fd, &addr, &len);
if (fd < 0)
goto drop;