net/6lo: First buffer fragment should hold the full compressed header

Current 6lo implementation is unable to deal with scattered headers
(which should not happen usually, though it's a valid use case), so
let's just fail uncompressing such packet then.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2021-02-04 08:26:31 +01:00 committed by Anas Nashif
parent 3fff3852fa
commit f729f82171
1 changed files with 5 additions and 0 deletions

View File

@ -1348,6 +1348,11 @@ static bool uncompress_IPHC_header(struct net_pkt *pkt)
nhc_inline_size;
}
if (pkt->buffer->len < compressed_hdr_size) {
NET_ERR("Scattered compressed header?");
return false;
}
if (net_buf_tailroom(pkt->buffer) >= diff) {
NET_DBG("Enough tailroom. Uncompress inplace");
frag = pkt->buffer;