File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,15 @@ impl InterfaceInner {
114
114
// unless we have a complete one after processing this fragment.
115
115
let frag = check ! ( SixlowpanFragPacket :: new_checked( payload) ) ;
116
116
117
+ // From RFC 4944 § 5.3: "The value of datagram_size SHALL be 40 octets more than the value
118
+ // of Payload Length in the IPv6 header of the packet."
119
+ // We should check that this is true, otherwise `buffer.split_at_mut(40)` will panic, since
120
+ // we assume that the decompressed packet is at least 40 bytes.
121
+ if frag. datagram_size ( ) < 40 {
122
+ net_debug ! ( "6LoWPAN: fragment size too small" ) ;
123
+ return None ;
124
+ }
125
+
117
126
// The key specifies to which 6LoWPAN fragment it belongs too.
118
127
// It is based on the link layer addresses, the tag and the size.
119
128
let key = FragKey :: Sixlowpan ( frag. get_key ( ieee802154_repr) ) ;
You can’t perform that action at this time.
0 commit comments