genl: Handle empty data in l_genl_msg_append_attr
Make sure l_genl_msg_append_attr can be called with a NULL @data (when
@len is 0) for attributes like nl80211 flags, without triggering an asan
warning about the memcpy parameter being NULL.
diff --git a/ell/genl.c b/ell/genl.c
index 32f54bc..2905a5e 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -790,7 +790,9 @@
nla->nla_len = NLA_HDRLEN + len;
nla->nla_type = type;
- memcpy(msg->data + msg->len + NLA_HDRLEN, data, len);
+ if (len)
+ memcpy(msg->data + msg->len + NLA_HDRLEN, data, len);
+
msg->len += NLA_HDRLEN + NLA_ALIGN(len);
return true;