about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-19 07:55:24 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-19 07:55:24 +0000
commit429bb1833efe87af5b75153b6c7fa9349cfff501 (patch)
tree79e96971dad10d1f78d7c05b1aec9565e725df24
parentf90de83143e5c0b9ba049323493a6fd5112e9991 (diff)
downloadglibc-429bb1833efe87af5b75153b6c7fa9349cfff501.tar.gz
glibc-429bb1833efe87af5b75153b6c7fa9349cfff501.tar.xz
glibc-429bb1833efe87af5b75153b6c7fa9349cfff501.zip
* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_sendreq): Make sure
	no uninitialized memory is passed to sendto.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 23110ba7ef..cab8422e52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_sendreq): Make sure
+	no uninitialized memory is passed to sendto.
+
 2006-05-18  Ulrich Drepper  <drepper@redhat.com>
 
 	* nis/nis_callback.c (__nis_create_callback): Use asprinf instead
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index e6720f0ca2..82495de03e 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -89,10 +89,11 @@ __netlink_free_handle (struct netlink_handle *h)
 static int
 __netlink_sendreq (struct netlink_handle *h, int type)
 {
-  struct
+  struct req
   {
     struct nlmsghdr nlh;
     struct rtgenmsg g;
+    char pad[0];
   } req;
   struct sockaddr_nl nladdr;
 
@@ -105,6 +106,8 @@ __netlink_sendreq (struct netlink_handle *h, int type)
   req.nlh.nlmsg_pid = 0;
   req.nlh.nlmsg_seq = h->seq;
   req.g.rtgen_family = AF_UNSPEC;
+  if (sizeof (req) != offsetof (struct req, pad))
+    memset (req.pad, '\0', sizeof (req) - offsetof (struct req, pad));
 
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;