net: 6lowpan: Check packet size before accepting fragment
If the fragment is corrupted and tells that the total packet size is too big, then we must discard the packet. Change-Id: I6257d677d1d2cfc30f37ad6fe4d59051d0e041ef Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
158cdbf91a
commit
746f81be1b
1 changed files with 6 additions and 0 deletions
|
@ -627,6 +627,12 @@ static int reassemble(struct net_buf *mbuf)
|
|||
|
||||
PRINTF("size %d, tag %d, offset %d\n", frag_size, frag_tag, frag_offset);
|
||||
|
||||
if (frag_size > IP_BUF_MAX_DATA) {
|
||||
PRINTF("Too big packet %d bytes (max %d), fragment discarded\n",
|
||||
frag_size, IP_BUF_MAX_DATA);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
uip_packetbuf_hdr_len(mbuf) += SICSLOWPAN_FRAG1_HDR_LEN;
|
||||
first_fragment = 1;
|
||||
is_fragment = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue