netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kangjie Lu <kangjielu@gmail.com>
To: jon.maloy@ericsson.com
Cc: ying.xue@windriver.com, davem@davemloft.net,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	taesoo@gatech.edu, csong84@gatech.edu,
	Kangjie Lu <kjlu@gatech.edu>
Subject: [PATCH] tipc: fix an infoleak in tipc_nl_compat_link_dump
Date: Wed,  1 Jun 2016 12:34:55 -0400	[thread overview]
Message-ID: <1464798895-26870-1-git-send-email-kjlu@gatech.edu> (raw)

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>
---
 net/tipc/netlink_compat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index f795b1d..115aafa 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -604,6 +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]));
+	memset((void *)link_info.str, 0, TIPC_MAX_LINK_NAME);
 	strcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]));
 
 	return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO,
-- 
2.7.4

             reply	other threads:[~2016-06-01 16:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 16:34 Kangjie Lu [this message]
2016-06-02  6:32 ` [PATCH] tipc: fix an infoleak in tipc_nl_compat_link_dump David Miller
  -- strict thread matches above, loose matches on Subject: below --
2016-06-02  8:04 Kangjie Lu
2016-06-03  4:32 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464798895-26870-1-git-send-email-kjlu@gatech.edu \
    --to=kangjielu@gmail.com \
    --cc=csong84@gatech.edu \
    --cc=davem@davemloft.net \
    --cc=jon.maloy@ericsson.com \
    --cc=kjlu@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=taesoo@gatech.edu \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).