Perform range check on len in nlmsg_reserve am: f83d9c1c67 am: d42374324d am: d9f824b744 am: 25edb109fc am: b0a4ed4800 am: 65d4de583a am: 45c4ce4768 am: 642a497f9c am: 170a7d24f4
am: 0a37ab0fdd

Change-Id: I57fdb95dc2d530bafd70c862b92cc2b1b7476335
diff --git a/lib/msg.c b/lib/msg.c
index 9fe9d54..91b86cb 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -518,6 +518,9 @@
 	size_t nlmsg_len = n->nm_nlh->nlmsg_len;
 	size_t tlen;
 
+	if (len > n->nm_size)
+		return NULL;
+
 	tlen = pad ? ((len + (pad - 1)) & ~(pad - 1)) : len;
 
 	if ((tlen + nlmsg_len) > n->nm_size)