diff options
author | Mathias Krause <minipli@googlemail.com> | 2013-09-30 16:05:07 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-10-02 11:28:20 -0400 |
commit | ca0a10672dad94aa1f89645f89eb6047b7bf2a19 (patch) | |
tree | f496c09f09049e67a9a7e7e6c73ffe6029b1c229 /net/bridge | |
parent | c31eeaced22ce8bd61268a3c595d542bb38c0a4f (diff) |
netfilter: ebt_ulog: fix info leaks
The ulog messages leak heap bytes by the means of padding bytes and
incompletely filled string arrays. Fix those by memset(0)'ing the
whole struct before filling it.
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/ebt_ulog.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 518093802d1d..7c470c371e14 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -181,6 +181,7 @@ static void ebt_ulog_packet(struct net *net, unsigned int hooknr, | |||
181 | ub->qlen++; | 181 | ub->qlen++; |
182 | 182 | ||
183 | pm = nlmsg_data(nlh); | 183 | pm = nlmsg_data(nlh); |
184 | memset(pm, 0, sizeof(*pm)); | ||
184 | 185 | ||
185 | /* Fill in the ulog data */ | 186 | /* Fill in the ulog data */ |
186 | pm->version = EBT_ULOG_VERSION; | 187 | pm->version = EBT_ULOG_VERSION; |
@@ -193,8 +194,6 @@ static void ebt_ulog_packet(struct net *net, unsigned int hooknr, | |||
193 | pm->hook = hooknr; | 194 | pm->hook = hooknr; |
194 | if (uloginfo->prefix != NULL) | 195 | if (uloginfo->prefix != NULL) |
195 | strcpy(pm->prefix, uloginfo->prefix); | 196 | strcpy(pm->prefix, uloginfo->prefix); |
196 | else | ||
197 | *(pm->prefix) = '\0'; | ||
198 | 197 | ||
199 | if (in) { | 198 | if (in) { |
200 | strcpy(pm->physindev, in->name); | 199 | strcpy(pm->physindev, in->name); |
@@ -204,16 +203,14 @@ static void ebt_ulog_packet(struct net *net, unsigned int hooknr, | |||
204 | strcpy(pm->indev, br_port_get_rcu(in)->br->dev->name); | 203 | strcpy(pm->indev, br_port_get_rcu(in)->br->dev->name); |
205 | else | 204 | else |
206 | strcpy(pm->indev, in->name); | 205 | strcpy(pm->indev, in->name); |
207 | } else | 206 | } |
208 | pm->indev[0] = pm->physindev[0] = '\0'; | ||
209 | 207 | ||
210 | if (out) { | 208 | if (out) { |
211 | /* If out exists, then out is a bridge port */ | 209 | /* If out exists, then out is a bridge port */ |
212 | strcpy(pm->physoutdev, out->name); | 210 | strcpy(pm->physoutdev, out->name); |
213 | /* rcu_read_lock()ed by nf_hook_slow */ | 211 | /* rcu_read_lock()ed by nf_hook_slow */ |
214 | strcpy(pm->outdev, br_port_get_rcu(out)->br->dev->name); | 212 | strcpy(pm->outdev, br_port_get_rcu(out)->br->dev->name); |
215 | } else | 213 | } |
216 | pm->outdev[0] = pm->physoutdev[0] = '\0'; | ||
217 | 214 | ||
218 | if (skb_copy_bits(skb, -ETH_HLEN, pm->data, copy_len) < 0) | 215 | if (skb_copy_bits(skb, -ETH_HLEN, pm->data, copy_len) < 0) |
219 | BUG(); | 216 | BUG(); |