netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tipc: fix nl compat regression for link statistics
@ 2016-07-01  9:11 Richard Alpe
  2016-07-01 20:49 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Alpe @ 2016-07-01  9:11 UTC (permalink / raw)
  To: netdev; +Cc: tipc-discussion, kjlu, Richard Alpe

Fix incorrect use of nla_strlcpy() where the first NLA_HDRLEN bytes
of the link name where left out.

Making the output of tipc-config -ls look something like:
Link statistics:
dcast-link
1:data0-1.1.2:data0
1:data0-1.1.3:data0

Also, for the record, the patch that introduce this regression
claims "Sending the whole object out can cause a leak". Which isn't
very likely as this is a compat layer, where the data we are parsing
is generated by us and we know the string to be NULL terminated. But
you can of course never be to secure.

Fixes: 5d2be1422e02 (tipc: fix an infoleak in tipc_nl_compat_link_dump)
Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
---
 net/tipc/netlink_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 3ad9fab..1fd4647 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -604,7 +604,7 @@ 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]));
-	nla_strlcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]),
+	nla_strlcpy(link_info.str, link[TIPC_NLA_LINK_NAME],
 		    TIPC_MAX_LINK_NAME);
 
 	return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tipc: fix nl compat regression for link statistics
  2016-07-01  9:11 [PATCH net-next] tipc: fix nl compat regression for link statistics Richard Alpe
@ 2016-07-01 20:49 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-07-01 20:49 UTC (permalink / raw)
  To: richard.alpe; +Cc: netdev, kjlu, tipc-discussion

From: Richard Alpe <richard.alpe@ericsson.com>
Date: Fri, 1 Jul 2016 11:11:21 +0200

> Fix incorrect use of nla_strlcpy() where the first NLA_HDRLEN bytes
> of the link name where left out.
> 
> Making the output of tipc-config -ls look something like:
> Link statistics:
> dcast-link
> 1:data0-1.1.2:data0
> 1:data0-1.1.3:data0
> 
> Also, for the record, the patch that introduce this regression
> claims "Sending the whole object out can cause a leak". Which isn't
> very likely as this is a compat layer, where the data we are parsing
> is generated by us and we know the string to be NULL terminated. But
> you can of course never be to secure.
> 
> Fixes: 5d2be1422e02 (tipc: fix an infoleak in tipc_nl_compat_link_dump)
> Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>

Applied to 'net' since that is where the regression exists.

Please submit bug fixes to the correct tree.

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-01 20:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01  9:11 [PATCH net-next] tipc: fix nl compat regression for link statistics Richard Alpe
2016-07-01 20:49 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).