From aff59df2575f773855b00b001ebd71cb7e55942e Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 31 Aug 2020 15:34:09 +0300 Subject: executor/common_linux.h: extend netlink helpers to support zero-payload attributes (flags) This is required for 802.11 pseudo syscalls (that will be added later). --- executor/common_linux.h | 3 ++- pkg/csource/generated.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/executor/common_linux.h b/executor/common_linux.h index 04a8c35b5..e472e7644 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -150,7 +150,8 @@ static void netlink_attr(struct nlmsg* nlmsg, int typ, struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; - memcpy(attr + 1, data, size); + if (size > 0) + memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 13d976321..5d14e7c7a 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -2381,7 +2381,8 @@ static void netlink_attr(struct nlmsg* nlmsg, int typ, struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; - memcpy(attr + 1, data, size); + if (size > 0) + memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } -- cgit mrf-deployment