Re: [PATCH] [TOKENRING] OLYMPIC: insufficient buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't have a problem with this patch. It's more "correct" than me 
hardcoding the size of the buffer which was done when we knew that the 
dev->name would be trN. 

Mike Phillips
Token-Ring Maintainer. (for my sins)





YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Sent by: linux-net-owner@vger.kernel.org
07/01/2003 08:06 AM

 
        To:     mikep@linuxtr.net, davem@redhat.com
        cc:     linux-net@vger.kernel.org, linux-tr@linuxtr.net
        Subject:        [PATCH] [TOKENRING] OLYMPIC: insufficient buffer


Hello.

This patch fixes insufficient buffer for creating / 
destroying proc entry and possible overrun.

Thanks in advance.

Index: linux-2.5/drivers/net/tokenring/olympic.c
===================================================================
RCS file: /home/cvs/linux-2.5/drivers/net/tokenring/olympic.c,v
retrieving revision 1.23
diff -u -r1.23 olympic.c
--- linux-2.5/drivers/net/tokenring/olympic.c            3 Jun 2003 
15:56:31 -0000           1.23
+++ linux-2.5/drivers/net/tokenring/olympic.c            1 Jul 2003 
10:32:50 -0000
@@ -267,9 +267,9 @@
                 register_netdev(dev) ; 
                 printk("Olympic: %s registered as: 
%s\n",olympic_priv->olympic_card_name,dev->name);
                 if (olympic_priv->olympic_network_monitor) { /* Must go 
after register_netdev as we need the device name */ 
-                                char proc_name[20] ; 
+                                char proc_name[12+IFNAMSIZ+1] ; 
                                 strcpy(proc_name,"net/olympic_") ; 
-                                strcat(proc_name,dev->name) ; 
+                                strncat(proc_name,dev->name,IFNAMSIZ) ; 
 create_proc_read_entry(proc_name,0,0,olympic_proc_info,(void *)dev) ; 
                                 printk("Olympic: Network Monitor 
information: /proc/%s\n",proc_name); 
                 }
@@ -1768,9 +1768,9 @@
                 struct olympic_private *olympic_priv=(struct 
olympic_private *)dev->priv;
 
                 if (olympic_priv->olympic_network_monitor) { 
-                                char proc_name[20] ; 
+                                char proc_name[12+IFNAMSIZ+1] ; 
                                 strcpy(proc_name,"net/olympic_") ; 
-                                strcat(proc_name,dev->name) ;
+                                strncat(proc_name,dev->name,IFNAMSIZ) ;
                                 remove_proc_entry(proc_name,NULL); 
                 }
                 unregister_netdev(dev) ; 

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux