rt2x00: unterminated strlen of user data
authorOne Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Mon, 15 Feb 2016 19:04:56 +0000 (19:04 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 7 Mar 2016 12:00:25 +0000 (14:00 +0200)
The buffer needs to be zero terminated in case the user data is not.
Otherwise we run off the end of the buffer.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c

index 25ee3cb8e982db287ac269cac97666ad7dd60ec6..72ae530e4a3bdc499f73ef72e3ce8c85351b8033 100644 (file)
@@ -478,7 +478,7 @@ static ssize_t rt2x00debug_write_##__name(struct file *file,        \
 {                                                              \
        struct rt2x00debug_intf *intf = file->private_data;     \
        const struct rt2x00debug *debug = intf->debug;          \
-       char line[16];                                          \
+       char line[17];                                          \
        size_t size;                                            \
        unsigned int index = intf->offset_##__name;             \
        __type value;                                           \
@@ -494,7 +494,8 @@ static ssize_t rt2x00debug_write_##__name(struct file *file,        \
                                                                \
        if (copy_from_user(line, buf, length))                  \
                return -EFAULT;                                 \
-                                                               \
+       line[16] = 0;                                           \
+                                               \
        size = strlen(line);                                    \
        value = simple_strtoul(line, NULL, 0);                  \
                                                                \
This page took 0.025934 seconds and 5 git commands to generate.