[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1471110178.586471220@decadent.org.uk>
Date: Sat, 13 Aug 2016 18:42:58 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Kangjie Lu" <kjlu@...ech.edu>,
"David S. Miller" <davem@...emloft.net>,
"Kangjie Lu" <kangjielu@...il.com>
Subject: [PATCH 3.2 91/94] tipc: fix an infoleak in tipc_nl_compat_link_dump
3.2.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kangjie Lu <kangjielu@...il.com>
commit 5d2be1422e02ccd697ccfcd45c85b4a26e6178e2 upstream.
link_info.str is a char array of size 60. Memory after the NULL
byte is not initialized. Sending the whole object out can cause
a leak.
Signed-off-by: Kangjie Lu <kjlu@...ech.edu>
Signed-off-by: David S. Miller <davem@...emloft.net>
[bwh: Backported to 3.2: the unpadded strcpy() is in tipc_node_get_links()
and no nlattr is involved, so use strncpy()]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -485,7 +485,8 @@ struct sk_buff *tipc_node_get_links(cons
continue;
link_info.dest = htonl(n_ptr->addr);
link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
- strcpy(link_info.str, n_ptr->links[i]->name);
+ strncpy(link_info.str, n_ptr->links[i]->name,
+ sizeof(link_info.str));
tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
&link_info, sizeof(link_info));
}
Powered by blists - more mailing lists