kernel-netlink: Actually verify if the netlink message exceeds the buffer size

It might equal it and that's fine. With MSG_TRUNC we get the actual
message size and can only report an error if we haven't received the
complete message.
This commit is contained in:
Tobias Brunner
2015-08-04 14:15:18 +02:00
parent a7f381ef00
commit a6896b6149
@@ -185,8 +185,8 @@ static ssize_t read_msg(private_netlink_socket_t *this,
return -1;
}
}
len = recv(this->socket, buf, buflen, block ? 0 : MSG_DONTWAIT);
if (len == buflen)
len = recv(this->socket, buf, buflen, MSG_TRUNC|(block ? 0 : MSG_DONTWAIT));
if (len > buflen)
{
DBG1(DBG_KNL, "netlink response exceeds buffer size");
return 0;