Re: [PATCH] printk: fix buffer overflow potential for print_text()
From: John Ogness
Date: Sun Jan 24 2021 - 03:15:08 EST
Hi Sven,
Thanks for the outstanding analysis!
On 2021-01-23, Sven Schnelle <svens@xxxxxxxxxxxxx> wrote:
>> 1401 if (buf_size > 0)
>> 1402 text[len] = 0;
>
> I don't think i have really understood how all the printk magic works,
> but using r->text_buf[len] seems to be the correct place to put the
> zero byte in that case?
Yes, you are correct! @text is pointing to the beginning of the
currently processed line, not the beginning of the buffer.
I will submit a patch to fix our recent fix (unless you would like to do
that).
Thank you for all your help with this!
John Ogness