Moving msg_len check uo & local msg_len
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index de7eb11..fea6676 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -130,9 +130,6 @@
 :: include('_oftype_readers.lua')
 
 function dissect_of_message(buf, root)
-    if buf:len() < 2 then
-        return "Unknown OF message", "Dissection error"
-    end
     local reader = OFReader.new(buf)
     local subtree = root:add(p_of, buf(0))
     local version_val = buf(0,1):uint()
@@ -157,7 +154,12 @@
     current_pkt = pkt
     repeat
         if buf:len() - offset >= 4 then
-            msg_len = buf(offset+2,2):uint()
+            local msg_len = buf(offset+2,2):uint()
+
+            if msg_len < 8 then
+                break
+            end
+
             if offset + msg_len > buf:len() then
                 -- we don't have all the data we need yet
                 pkt.desegment_len = offset + msg_len - buf:len()
@@ -176,10 +178,6 @@
             pkt.cols.protocol:append(protocol)
             pkt.cols.info:append(info)
             offset = offset + msg_len
-            if msg_len == 0 then
-                offset = buf:len()
-                break
-            end
         else
             -- we don't have all of length field yet
             pkt.desegment_len = DESEGMENT_ONE_MORE_SEGMENT