diff options
author | Phil Sutter <phil@nwl.cc> | 2024-03-07 14:34:18 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2024-04-11 01:27:07 +0200 |
commit | c48ac8cba8716a8bc4ff713ee965eee2643cfc31 (patch) | |
tree | 26db3c43168b0111bd7a132918f48a6777b66685 /src/obj/quota.c | |
parent | bb5e75be9d28c37096c90d9ae9fcc7ad0841f2c2 (diff) |
obj: Respect data_len when setting attributes
With attr_policy in place, data_len has an upper boundary. Use it for
memcpy() calls to cover for caller passing data with lower size than the
attribute's storage.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/obj/quota.c')
-rw-r--r-- | src/obj/quota.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/obj/quota.c b/src/obj/quota.c index b48ba91..526db8e 100644 --- a/src/obj/quota.c +++ b/src/obj/quota.c @@ -28,13 +28,13 @@ static int nftnl_obj_quota_set(struct nftnl_obj *e, uint16_t type, switch (type) { case NFTNL_OBJ_QUOTA_BYTES: - memcpy("a->bytes, data, sizeof(quota->bytes)); + memcpy("a->bytes, data, data_len); break; case NFTNL_OBJ_QUOTA_CONSUMED: - memcpy("a->consumed, data, sizeof(quota->consumed)); + memcpy("a->consumed, data, data_len); break; case NFTNL_OBJ_QUOTA_FLAGS: - memcpy("a->flags, data, sizeof(quota->flags)); + memcpy("a->flags, data, data_len); break; } return 0; |