can-bcm: fix minor heap overflow
Subsystems (3)
Oliver Hartkopp
maintainerOn 64-bit platforms the ASCII representation of a pointer may be up to 17 bytes long. This patch increases the length of the buffer accordingly.
http://marc.info/?l=linux-netdev&m=128872251418192&w=2
---
net/can/bcm.c +1 -1
@@ -125,7 +125,7 @@ struct bcm_sock {struct list_head tx_ops;unsigned long dropped_usr_msgs;struct proc_dir_entry *bcm_proc_read; -char procname [9 ];/* pointer printed in ASCII with \0 */ +char procname [20 ];/* pointer printed in ASCII with \0 */ };static inline struct bcm_sock *bcm_sk (const struct sock *sk)
Quoted 16 lines · Oliver Hartkopp
On 64-bit platforms the ASCII representation of a pointer may be up to 17 bytes long. This patch increases the length of the buffer accordingly.
http://marc.info/?l=linux-netdev&m=128872251418192&w=2
Reported-by Dan Rosenberg <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>CC Linus Torvalds <[email protected]>---
net/can/bcm.c +0
-0
net/can/bcm.c struct bcm_sock { · line 129
Quoted 6 lines
net/can/bcm.c +1
-1@@ -125,7 +125,7 @@ struct bcm_sock {struct list_head tx_ops;unsigned long dropped_usr_msgs;struct proc_dir_entry *bcm_proc_read; -char procname [9 ];/* pointer printed in ASCII with \0 */ +char procname [20 ];/* pointer printed in ASCII with \0 */ };
If the string may be up to 17 bytes long why are you allocating 20?
Quoted 1 line
net/can/bcm.c +0
-0static inline struct bcm_sock *bcm_sk (const struct sock *sk)
Quoted 4 lines
If the string may be up to 17 bytes long why are you allocating 20?
In Oliver's defense, this doesn't matter even a little bit. The structure will be allocated with kmalloc-1024 either way.
-Dan
Quoted 7 lines · Dan Rosenberg
Quoted 4 lines
If the string may be up to 17 bytes long why are you allocating 20?
In Oliver's defense, this doesn't matter even a little bit. The structure will be allocated with kmalloc-1024 either way.
I agree that its very unlikely to make any difference. I am just curious.
David Miller
maintainerFrom: Oliver Hartkopp <[email protected]>
Date: Wed, 10 Nov 2010 23:10:30 +0100
Quoted 8 lines
On 64-bit platforms the ASCII representation of a pointer may be up to 17 bytes long. This patch increases the length of the buffer accordingly.
http://marc.info/?l=linux-netdev&m=128872251418192&w=2
Reported-by Dan Rosenberg <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>CC Linus Torvalds <[email protected]>
Patch applied, thanks.