Skip to content

Commit dffd22a

Browse files
thejhummakynes
authored andcommitted
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: c6ac37d ("netfilter: nf_log: fix error on write NONE to [...]") Signed-off-by: Jann Horn <jannh@google.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent ad9852a commit dffd22a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/netfilter/nf_log.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ static int nf_log_proc_dostring(struct ctl_table *table, int write,
424424
if (write) {
425425
struct ctl_table tmp = *table;
426426

427+
/* proc_dostring() can append to existing strings, so we need to
428+
* initialize it as an empty string.
429+
*/
430+
buf[0] = '\0';
427431
tmp.data = buf;
428432
r = proc_dostring(&tmp, write, buffer, lenp, ppos);
429433
if (r)

0 commit comments

Comments
 (0)