* [PATCH net] netfilter: nf_log: fix uninit read in nf_log_proc_dostring
@ 2018-06-20 16:33 Jann Horn
2018-06-26 16:05 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Jann Horn @ 2018-06-20 16:33 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam, jannh
Cc: David S. Miller, netdev, linux-kernel
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>
---
net/netfilter/nf_log.c | 4 ++++
1 file changed, 4 insertions(+)
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)
--
2.18.0.rc1.244.gcf134e6275-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] netfilter: nf_log: fix uninit read in nf_log_proc_dostring
2018-06-20 16:33 [PATCH net] netfilter: nf_log: fix uninit read in nf_log_proc_dostring Jann Horn
@ 2018-06-26 16:05 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2018-06-26 16:05 UTC (permalink / raw)
To: Jann Horn
Cc: Jozsef Kadlecsik, Florian Westphal, netfilter-devel, coreteam,
David S. Miller, netdev, linux-kernel
On Wed, Jun 20, 2018 at 06:33:45PM +0200, Jann Horn wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-26 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-20 16:33 [PATCH net] netfilter: nf_log: fix uninit read in nf_log_proc_dostring Jann Horn
2018-06-26 16:05 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).