ignore Drw data packets that are too short to be valid

This commit is contained in:
David Ventura
2024-05-03 18:10:42 +02:00
parent a93564cd11
commit c81d7d4182
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -18,6 +18,8 @@ ilnk_proto.fields.start = ProtoField.uint16("iLnkP2P.start", "Start", base.HE
ilnk_proto.fields.cmd_dest = ProtoField.uint16("iLnkP2P.cmd_dest", "Dest", base.HEX)
ilnk_proto.fields.auth_token = ProtoField.bytes("iLnkP2P.auth_token", "CMD auth token", base.DASH)
ilnk_proto.fields.cmd_payload = ProtoField.bytes("iLnkP2P.payload", "CMD Payload", base.DASH)
ilnk_proto.fields.warning = ProtoField.string("iLnkP2P.warning", "Warning")
--
-- jpeg | audio | continuation type?
ilnk_proto.fields.data_payload = ProtoField.bytes("iLnkP2P.data_payload", "Data Payload", base.DASH)
ilnk_proto.fields.payload_type = ProtoField.string("iLnkP2P.payload_type", "Payload type")
@@ -106,7 +108,12 @@ function ilnk_proto.dissector(buffer, pinfo, tree)
subtree:add(ilnk_proto.fields.len, b_pkt_len)
subtree:add(ilnk_proto.fields.m_type, buffer(4, 1))
subtree:add(ilnk_proto.fields.m_stream_id, buffer(5, 1))
if pkt_len < 12 then
subtree:add(ilnk_proto.fields.warning, "Short read"):set_generated()
return
end
subtree:add(ilnk_proto.fields.pkt_seq, buffer(6, 2))
pinfo.cols.info:set(buffer(6, 2):uint())
local b_payload_len = buffer(0xc, 2)
local payload_len = buffer(0xc, 2):le_uint()
+7
View File
@@ -135,6 +135,13 @@ export const createResponseForControlCommand = (session: Session, dv: DataView):
const deal_with_data = (session: Session, dv: DataView) => {
const pkt_len = dv.add(2).readU16();
// 12 equals start of header (0x8) + header length (0x4)
if (pkt_len < 12) {
logger.debug("Got a short Drw packet, ignoring");
return;
}
const FRAME_HEADER = [0x55, 0xaa, 0x15, 0xa8];
const m_hdr = dv.add(8).readByteArray(4);
const pkt_id = dv.add(6).readU16();