about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-06 22:07:31 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-06 22:07:31 +0000
commitb74a8c7f5f3f76db2ecb46cc421faec2d234a6bc (patch)
tree3a565564254948920c15061b4b4bcfc8e1e6f502 /sysdeps/unix/sysv
parentacb98cb57d3d84f7f9410746ba82581d445158e1 (diff)
downloadglibc-b74a8c7f5f3f76db2ecb46cc421faec2d234a6bc.tar.gz
glibc-b74a8c7f5f3f76db2ecb46cc421faec2d234a6bc.tar.xz
glibc-b74a8c7f5f3f76db2ecb46cc421faec2d234a6bc.zip
,
	* sysdeps/unix/sysv/linux/check_pf.c (make_request): Make sure
	that unused memory passed to sendto is nevertheless initialized.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index f186182cf6..7fbb7543d6 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -17,9 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
 #include <netdb.h>
+#include <stddef.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
@@ -42,10 +44,14 @@ static int
 make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
 	      struct in6addrinfo **in6ai, size_t *in6ailen)
 {
-  struct
+  struct req
   {
     struct nlmsghdr nlh;
     struct rtgenmsg g;
+    /* struct rtgenmsg consists of a single byte.  This means there
+       are three bytes of padding included in the REQ definition.
+       We make them explicit here.  */
+    char pad[3];
   } req;
   struct sockaddr_nl nladdr;
 
@@ -56,6 +62,9 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
   req.nlh.nlmsg_seq = time (NULL);
   req.g.rtgen_family = AF_UNSPEC;
 
+  assert (sizeof (req) - offsetof (struct req, pad) == 3);
+  memset (req.pad, '\0', sizeof (req.pad));
+
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;