From 5a9f50b8e9be45094acbe313b31a81ceaabc6c96 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Thu, 17 Mar 2011 16:03:11 +0100 Subject: __nlmsg_alloc(): Guarantee minimal message size of at least the header --- lib/msg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/msg.c b/lib/msg.c index 95ad188..5c852c0 100644 --- a/lib/msg.c +++ b/lib/msg.c @@ -400,6 +400,9 @@ static struct nl_msg *__nlmsg_alloc(size_t len) { struct nl_msg *nm; + if (len < sizeof(struct nlmsghdr)) + len = sizeof(struct nlmsghdr); + nm = calloc(1, sizeof(*nm)); if (!nm) goto errout; -- cgit v1.2.1