aboutsummaryrefslogtreecommitdiff
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorJiri Slaby <[email protected]>2012-04-26 20:13:00 +0200
committerGreg Kroah-Hartman <[email protected]>2012-04-29 22:13:54 -0400
commit3fa10cc83fb92750af11fab81e11ad96dc75d656 (patch)
treee583b1cafbf3b1ad5a5bab1ad481a2925b7e3742 /lib/string_helpers.c
parent5d1a33fa5573702394a4d09a9872f3f930c06d58 (diff)
TTY: n_tty, do not dereference user buffer
copy_from_read_buf currently copies data to a user buffer and then checks if the data is single EOF. But it checks it by accessing the user buffer. First, the buffer may be changed by other threads of the user program already. Second, it accesses the buffer without any checks. It might be write-only for example. Fix this by inspecting contents of the tty (kernel) buffer instead. Note that "n == 1" is necessary, but not sufficient. But we check later that there is nothing left by "!tty->read_cnt" condition. There is still an issue with the current code that EOF being wrapped to the start of the circular buffer will result in an inappropriate losing of the EOF character. But this is not intended to be fixed by this patch. Signed-off-by: Jiri Slaby <[email protected]> Reported-by: Emil Goode <[email protected]> Cc: Howard Chu <[email protected]> Cc: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions