Skip to content

Commit

Permalink
openvswitch: Use proper buffer size in nla_memcpy
Browse files Browse the repository at this point in the history
For the input parameter count, it's better to use the size
of destination buffer size, as nla_memcpy would take into
account the length of the source netlink attribute when
a data is copied from an attribute.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Haishuang Yan authored and David S. Miller committed Mar 28, 2016
1 parent d7be81a commit ac71b46
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/openvswitch/conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,8 @@ static int parse_nat(const struct nlattr *attr,
break;

case OVS_NAT_ATTR_IP_MIN:
nla_memcpy(&info->range.min_addr, a, nla_len(a));
nla_memcpy(&info->range.min_addr, a,
sizeof(info->range.min_addr));
info->range.flags |= NF_NAT_RANGE_MAP_IPS;
break;

Expand Down

0 comments on commit ac71b46

Please sign in to comment.