Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH -next] netrom: fix invalid use of sizeof in nr_recvmsg()
@ 2013-04-21 17:56 f6bvp@free
  2013-04-21 18:00 ` Mathias Krause
  0 siblings, 1 reply; 8+ messages in thread
From: f6bvp@free @ 2013-04-21 17:56 UTC (permalink / raw)
  To: netdev, Mathias Krause

Hi,

According to the proximity of NetRom and Rose codes I looked at af_rose.c
and it seems that similarly sockaddr_rose structure is let uninitialized 
in rose_recvmsg().

Then, would you consider the following patch interesting to be committed ?

--- a/net/rose/af_rose.c        2013-04-17 07:11:28.000000000 +0200
+++ b/net/rose/af_rose.c        2013-04-21 17:26:06.914967897 +0200
@@ -1257,6 +1257,7 @@ static int rose_recvmsg(struct kiocb *io
         skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);

         if (srose != NULL) {
+               memset(srose, 0, sizeof(*srose));
                 srose->srose_family = AF_ROSE;
                 srose->srose_addr   = rose->dest_addr;
                 srose->srose_call   = rose->dest_call;


Bernard Pidoux

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH -next] netrom: fix invalid use of sizeof in nr_recvmsg()
@ 2013-04-09  2:07 Wei Yongjun
  2013-04-09  2:49 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wei Yongjun @ 2013-04-09  2:07 UTC (permalink / raw)
  To: ralf, minipli, davem; +Cc: yongjun_wei, linux-hams, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

sizeof() when applied to a pointer typed expression gives the size of the
pointer, not that of the pointed data.
Introduced by commit 3ce5ef(netrom: fix info leak via msg_name in nr_recvmsg)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 net/netrom/af_netrom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 7fcb307..103bd70 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1173,7 +1173,7 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,
 	}
 
 	if (sax != NULL) {
-		memset(sax, 0, sizeof(sax));
+		memset(sax, 0, sizeof(*sax));
 		sax->sax25_family = AF_NETROM;
 		skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call,
 			      AX25_ADDR_LEN);


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

end of thread, other threads:[~2013-04-21 18:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <51742437.6080406@free.fr>
2013-04-21 18:05 ` [PATCH -next] netrom: fix invalid use of sizeof in nr_recvmsg() f6bvp@free
2013-04-21 17:56 f6bvp@free
2013-04-21 18:00 ` Mathias Krause
  -- strict thread matches above, loose matches on Subject: below --
2013-04-09  2:07 Wei Yongjun
2013-04-09  2:49 ` David Miller
2013-04-09  3:05   ` Wei Yongjun
2013-04-09  3:09 ` Hannes Frederic Sowa
2013-04-09  5:49 ` Mathias Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox