genl: Handle empty data in l_genl_msg_append_attr
PATCH 1/1 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.
--- ell/genl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
ell/genl.c +3 -1
@@ -790,7 +790,9 @@ LIB_EXPORT bool l_genl_msg_append_attr(struct l_genl_msg *msg, uint16_t type, 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;
Signature · 1 line
2.19.1
Denis Kenzior
AppliedHi Andrew,
Quoted 6 lines · Andrew Zaborowski
Make sure
l_genl_msg_append_attrcan 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.--- ell/genl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
Regards,
-Denis