Wireshark-bugs: [Wireshark-bugs] [Bug 12299] New: Comparing tostring(pinfo.cols.protocol) == 'ud
Date: Mon, 28 Mar 2016 07:50:00 +0000
Bug ID 12299
Summary Comparing tostring(pinfo.cols.protocol) == 'udp' crashes Wireshark
Product Wireshark
Version 2.0.2
Hardware x86
OS Windows 7
Status UNCONFIRMED
Severity Major
Priority Low
Component Dissection engine (libwireshark)
Assignee bugzilla-admin@wireshark.org
Reporter guibufolo+wireshark@gmail.com

Build Information:
Wireshark Version 2.0.2 (v2.0.2-0-ga16e22e from master-2.0)


--


In my custom dissector i'm having the problem that my dissector isbeing
executed on ICMP packages aswell as UDP. In ICMP packages the data is
incomplete so the lua script crashes.

To avoid running it on ICMP packages I tried comparing the current protocol to
UDP but that crashes Wireshark.

I'm not sure if that is the best way of doing it so I'm open to any other
suggestion

function setDefault (t, d)
    local mt = {__index = function () return d end}
    setmetatable(t, mt)
end

do

    local protocols = {
        [0] = "RED"
    }

    local directions = {
        [0] = "Rx",
        [1] = "Tx",
        [2] = "RxTx"
    }

    setDefault(protocols, "UNDEFINED")
    setDefault(directions, "UNKNOWN")
    local version = "" -- use this when debugging to increase the number of the
parser

    -- declare our protocol
    local gsg_proto = Proto("GSG"..version, "GSG"..version)

    -- create a function to dissect it
    function gsg_proto.dissector(buffer, pinfo, tree)
        message("protocol >"..tostring(pinfo.cols.protocol).."<") -- this works
fine
        if tostring(pinfo.cols.protocol) == 'udp' then
            pinfo.cols.protocol = "myproto"
            return true
        end
    end

    gsg_proto:register_heuristic('udp', gsg_proto.dissector)
end

I have also posted this here:
https://ask.wireshark.org/questions/51179/comparing-tostringpinfocolsprotocol-udp-crashes-wireshark


You are receiving this mail because:
  • You are watching all bug changes.