diff options
author | Jann Horn <jannh@google.com> | 2018-06-20 18:33:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-24 13:09:07 +0200 |
commit | 4c3b0ae79f0736993c444980c40ebf7a103b6f39 (patch) | |
tree | 0eec30e2d7bb025d4418fe659760f3370a4aeefb | |
parent | 1ea053d1cc8bc6e52e5ecb34cafc1e41d33d5602 (diff) | |
download | linux-4c3b0ae79f0736993c444980c40ebf7a103b6f39.tar.gz |
netfilter: nf_log: fix uninit read in nf_log_proc_dostring
[ Upstream commit dffd22aed2aa1e804bccf19b30a421e89ee2ae61 ]
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: c6ac37d8d884 ("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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/netfilter/nf_log.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 276324abfa604d..cdc744aa58893c 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c @@ -440,6 +440,10 @@ static int nf_log_proc_dostring(struct ctl_table *table, int write, if (write) { 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; r = proc_dostring(&tmp, write, buffer, lenp, ppos); if (r) |