aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_log.c
diff options
context:
space:
mode:
authorJann Horn <jannh@google.com>2018-06-20 18:33:45 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-06-26 16:48:23 +0200
commitdffd22aed2aa1e804bccf19b30a421e89ee2ae61 (patch)
tree527ee8d7048c5e0df7398273a7bac5cac5bda6c5 /net/netfilter/nf_log.c
parentnetfilter: nf_ct_helper: Fix possible panic after nf_conntrack_helper_unregister (diff)
downloadlinux-dev-dffd22aed2aa1e804bccf19b30a421e89ee2ae61.tar.xz
linux-dev-dffd22aed2aa1e804bccf19b30a421e89ee2ae61.zip
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: 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>
Diffstat (limited to 'net/netfilter/nf_log.c')
-rw-r--r--net/netfilter/nf_log.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 426457047578..2c47f9ec3511 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -424,6 +424,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)