Re: [PATCH next 1/2] printk: avoid and/or handle record truncation

2020-09-29 Thread Sergey Senozhatsky
On (20/09/26 04:01), John Ogness wrote: > + if (text_len > buf_size) { > + text_len = buf_size; > + truncated = true; > + } > + > prefix_len = info_print_prefix(r->info, syslog, time, prefix); > > /* > @@ -1911,7 +1916,7 @@ static size_t log_output(int

Re: [PATCH next 1/2] printk: avoid and/or handle record truncation

2020-09-29 Thread Petr Mladek
On Sat 2020-09-26 04:01:25, John Ogness wrote: > If a reader provides a buffer that is smaller than the message text, > the @text_len field of @info will have a value larger than the buffer > size. If readers blindly read @text_len bytes of data without > checking the size, they will read beyond th

Re: [PATCH next 1/2] printk: avoid and/or handle record truncation

2020-09-27 Thread Marek Szyprowski
Hi John, On 26.09.2020 03:55, John Ogness wrote: > If a reader provides a buffer that is smaller than the message text, > the @text_len field of @info will have a value larger than the buffer > size. If readers blindly read @text_len bytes of data without > checking the size, they will read beyond

[PATCH next 1/2] printk: avoid and/or handle record truncation

2020-09-25 Thread John Ogness
If a reader provides a buffer that is smaller than the message text, the @text_len field of @info will have a value larger than the buffer size. If readers blindly read @text_len bytes of data without checking the size, they will read beyond their buffer. Add this check to record_print_text() to p