core: Drop trivial length packets
If we receive packets which are of length less than mctp header size,
we can drop them without passing through message assembly process.
Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com>
Change-Id: Idfe67530f7b2fb9c3ecb214a38f489a852b80c70
diff --git a/core.c b/core.c
index 6131a3c..42ef405 100644
--- a/core.c
+++ b/core.c
@@ -434,6 +434,10 @@
assert(bus);
+ /* Drop packet if it was smaller than mctp hdr size */
+ if (mctp_pktbuf_size(pkt) <= sizeof(struct mctp_hdr))
+ goto out;
+
hdr = mctp_pktbuf_hdr(pkt);
/* small optimisation: don't bother reassembly if we're going to