Skip to content

Commit 5d2be14

Browse files
kengiterdavem330
authored andcommitted
tipc: fix an infoleak in tipc_nl_compat_link_dump
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ce25d66 commit 5d2be14

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/tipc/netlink_compat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
604604

605605
link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]);
606606
link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP]));
607-
strcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]));
607+
nla_strlcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]),
608+
TIPC_MAX_LINK_NAME);
608609

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

0 commit comments

Comments
 (0)