Change-Id: Icc8430bb6090b71620650b9886478ba645a67b64
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
#include <linux/netlink.h>
#include <cstring>
+#include <limits>
#include <klay/error.h>
#include <klay/exception.h>
struct sockaddr_nl nladdr;
socklen_t nladdrlen = sizeof(nladdr);
+
+ if (nlh.nlmsg_len > (std::numeric_limits<decltype(nlh.nlmsg_len)>::max() - NLMSG_HDRLEN))
+ throw klay::Exception("Netlink message is too large.");
+
char buf[nlh.nlmsg_len + NLMSG_HDRLEN];
do {
ret = ::recvfrom(fd, buf, sizeof(buf), options,