mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
TTY: ttyprintk, don't touch behind tty->write_buf
commit ee8b593aff
upstream.
If a user provides a buffer larger than a tty->write_buf chunk and
passes '\r' at the end of the buffer, we touch an out-of-bound memory.
Add a check there to prevent this.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Samo Pogacnik <samo_pogacnik@t-2.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e2a43abf3d
commit
804f6a4a47
1 changed files with 1 additions and 1 deletions
|
@ -67,7 +67,7 @@ static int tpk_printk(const unsigned char *buf, int count)
|
||||||
tmp[tpk_curr + 1] = '\0';
|
tmp[tpk_curr + 1] = '\0';
|
||||||
printk(KERN_INFO "%s%s", tpk_tag, tmp);
|
printk(KERN_INFO "%s%s", tpk_tag, tmp);
|
||||||
tpk_curr = 0;
|
tpk_curr = 0;
|
||||||
if (buf[i + 1] == '\n')
|
if ((i + 1) < count && buf[i + 1] == '\n')
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
|
|
Loading…
Reference in a new issue