提交 dffd22ae 编写于 作者: J Jann Horn 提交者: Pablo Neira Ayuso

netfilter: nf_log: fix uninit read in nf_log_proc_dostring

When proc_dostring() is called with a non-zero offset in strict mode, it
doesn't just write to the ->data buffer, it also reads. Make sure it
doesn't read uninitialized data.

Fixes: c6ac37d8 ("netfilter: nf_log: fix error on write NONE to [...]")
Signed-off-by: NJann Horn <jannh@google.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 ad9852af
...@@ -424,6 +424,10 @@ static int nf_log_proc_dostring(struct ctl_table *table, int write, ...@@ -424,6 +424,10 @@ static int nf_log_proc_dostring(struct ctl_table *table, int write,
if (write) { if (write) {
struct ctl_table tmp = *table; struct ctl_table tmp = *table;
/* proc_dostring() can append to existing strings, so we need to
* initialize it as an empty string.
*/
buf[0] = '\0';
tmp.data = buf; tmp.data = buf;
r = proc_dostring(&tmp, write, buffer, lenp, ppos); r = proc_dostring(&tmp, write, buffer, lenp, ppos);
if (r) if (r)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册