Skip to content

Commit

Permalink
tipc: fix an infoleak in tipc_nl_compat_link_dump
Browse files Browse the repository at this point in the history
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@gatech.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kangjie Lu authored and David S. Miller committed Jun 3, 2016
1 parent ce25d66 commit 5d2be14
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/tipc/netlink_compat.c
Original file line number Diff line number Diff line change
@@ -604,7 +604,8 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,

link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]);
link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP]));
strcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]));
nla_strlcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]),
TIPC_MAX_LINK_NAME);

return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO,
&link_info, sizeof(link_info));

0 comments on commit 5d2be14

Please sign in to comment.