All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] [PATCH 1/2] rtcan_module: Fix tx_timeout buffer size inconsistency
@ 2013-03-17 18:56 Paul Janzen
  2013-03-17 19:16 ` [Xenomai] [PATCH 2/2] rtcan_module: Improve buffer size handling for /proc/rtcan entries Paul Janzen
  2013-04-09 19:32 ` [Xenomai] [PATCH 1/2] rtcan_module: Fix tx_timeout buffer size inconsistency Gilles Chanteperdrix
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Janzen @ 2013-03-17 18:56 UTC (permalink / raw)
  To: xenomai

When formatting /proc/rtcan/sockets, tx_timeout is defined as
char[16], but a length of 20 is passed to rtcan_get_timeout_name. If
tx_timeout for any socket is infinite, this causes snprintf to zero
outside the buffer, leading to stack overflow and a kernel panic.
Make the tx_timeout buffer 20 bytes long instead.

Signed-off-by: Paul Janzen <pcj@xenomai.sez.to>
---
 ksrc/drivers/can/rtcan_module.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ksrc/drivers/can/rtcan_module.c b/ksrc/drivers/can/rtcan_module.c
index 3ebc333..f270f65 100644
--- a/ksrc/drivers/can/rtcan_module.c
+++ b/ksrc/drivers/can/rtcan_module.c
@@ -165,7 +165,7 @@ static int rtcan_read_proc_sockets(char *buf, char **start, off_t offset,
     struct rtdm_dev_context *context;
     struct rtcan_device *dev;
     char name[IFNAMSIZ] = "not-bound";
-    char rx_timeout[20], tx_timeout[16];
+    char rx_timeout[20], tx_timeout[20];
     rtdm_lockctx_t lock_ctx;
     int ifindex;
     RTCAN_PROC_PRINT_VARS(120);
-- 
1.7.6.5



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

end of thread, other threads:[~2013-04-16  8:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-17 18:56 [Xenomai] [PATCH 1/2] rtcan_module: Fix tx_timeout buffer size inconsistency Paul Janzen
2013-03-17 19:16 ` [Xenomai] [PATCH 2/2] rtcan_module: Improve buffer size handling for /proc/rtcan entries Paul Janzen
2013-04-09 19:32 ` [Xenomai] [PATCH 1/2] rtcan_module: Fix tx_timeout buffer size inconsistency Gilles Chanteperdrix
2013-04-10 10:05   ` Wolfgang Grandegger
2013-04-14 15:04     ` Gilles Chanteperdrix
2013-04-15  6:20       ` Wolfgang Grandegger
2013-04-15  7:18         ` Paul Janzen
2013-04-16  8:00           ` Wolfgang Grandegger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.