Skip to content

Commit

Permalink
bridge: Add missing ntohs()s for MLDv2 report parsing
Browse files Browse the repository at this point in the history
The nsrcs number is 2 Byte wide, therefore we need to call ntohs()
before using it.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Linus Lüssing authored and David S. Miller committed Feb 22, 2011
1 parent 649e984 commit d41db9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/bridge/br_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,11 +1020,12 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br,

if (!pskb_may_pull(skb,
len + sizeof(*grec) +
sizeof(struct in6_addr) * (*nsrcs)))
sizeof(struct in6_addr) * ntohs(*nsrcs)))
return -EINVAL;

grec = (struct mld2_grec *)(skb->data + len);
len += sizeof(*grec) + sizeof(struct in6_addr) * (*nsrcs);
len += sizeof(*grec) +
sizeof(struct in6_addr) * ntohs(*nsrcs);

/* We treat these as MLDv1 reports for now. */
switch (grec->grec_type) {
Expand Down

0 comments on commit d41db9f

Please sign in to comment.