lkml.org 
[lkml]   [2008]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fs - fix name overwrite in __register_chrdev_region
It's possible to register chdev with a name size
exactly the same as was allocated in structure.
It seems it was not intedned behaviour.

At least chrdev_show does not like it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

fs/char_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/fs/char_dev.c
===================================================================
--- linux-2.6.git.orig/fs/char_dev.c
+++ linux-2.6.git/fs/char_dev.c
@@ -120,7 +120,7 @@ __register_chrdev_region(unsigned int ma
cd->major = major;
cd->baseminor = baseminor;
cd->minorct = minorct;
- strncpy(cd->name,name, 64);
+ strncpy(cd->name, name, sizeof(cd->name) - 1);

i = major_to_index(major);


\
 
 \ /
  Last update: 2008-12-13 22:51    [W:0.046 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site