summaryrefslogtreecommitdiffstats
path: root/src/expr/inner.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-03-07 14:49:08 +0100
committerPhil Sutter <phil@nwl.cc>2024-04-11 01:27:07 +0200
commitbe0bae0ad31b0adb506f96de083f52a2bd0d4fbf (patch)
tree378a1a3ffc541149493c184f0e3c21dfb675cebf /src/expr/inner.c
parentc48ac8cba8716a8bc4ff713ee965eee2643cfc31 (diff)
expr: Respect data_len when setting attributesHEADmaster
With attr_policy in place, data_len has an upper boundary but it may be lower than the attribute's storage area in which case memcpy() would read garbage. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/expr/inner.c')
-rw-r--r--src/expr/inner.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/expr/inner.c b/src/expr/inner.c
index 45ef4fb..4f66e94 100644
--- a/src/expr/inner.c
+++ b/src/expr/inner.c
@@ -45,13 +45,13 @@ nftnl_expr_inner_set(struct nftnl_expr *e, uint16_t type,
switch(type) {
case NFTNL_EXPR_INNER_TYPE:
- memcpy(&inner->type, data, sizeof(inner->type));
+ memcpy(&inner->type, data, data_len);
break;
case NFTNL_EXPR_INNER_FLAGS:
- memcpy(&inner->flags, data, sizeof(inner->flags));
+ memcpy(&inner->flags, data, data_len);
break;
case NFTNL_EXPR_INNER_HDRSIZE:
- memcpy(&inner->hdrsize, data, sizeof(inner->hdrsize));
+ memcpy(&inner->hdrsize, data, data_len);
break;
case NFTNL_EXPR_INNER_EXPR:
if (inner->expr)