[PATCH] openvswitch: Use proper buffer size in nla_memcpy

Subsystems: networking [general], openvswitch, the rest

STALE3814d

2 messages, 2 authors, 2016-03-28 · open the first message on its own page

[PATCH] openvswitch: Use proper buffer size in nla_memcpy

From: Haishuang Yan <hidden>
Date: 2016-03-28 10:09:10

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 <redacted>
---
 net/openvswitch/conntrack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index dc5eb29..f8a8d43 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -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;
 
-- 
1.8.3.1

Re: [PATCH] openvswitch: Use proper buffer size in nla_memcpy

From: David Miller <davem@davemloft.net>
Date: 2016-03-28 15:39:10

From: Haishuang Yan <redacted>
Date: Mon, 28 Mar 2016 18:08:59 +0800
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 <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help