Ethereal-dev: [Ethereal-dev] Small update to NMAS dissector

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Greg Morris" <gmorris@xxxxxxxxxx>
Date: Fri, 14 Jan 2005 08:45:02 -0700
Found an occurance of a malformed packet. This patch resolves this
problem. Patch is based on current svn.

Please commit. 
Greg
Index: packet-ncp-nmas.c
===================================================================
--- packet-ncp-nmas.c	(revision 13018)
+++ packet-ncp-nmas.c	(working copy)
@@ -504,6 +504,8 @@
         foffset += 4;
         break;
     case 2:
+        proto_tree_add_text(atree, tvb, foffset, -1, "Verb: %s",
+                            val_to_str(subverb, nmas_subverb_enum, "Unknown (%u)"));
         proto_tree_add_item(atree, hf_length, tvb, foffset, 4, TRUE);
         msg_length = tvb_get_letohl(tvb, foffset);
         foffset +=4;
@@ -513,9 +515,7 @@
         roffset = foffset;
         foffset += 4;
         msg_length -= 8;
-        proto_tree_add_text(atree, tvb, foffset, -1, "Verb: %s",
-                            val_to_str(subverb, nmas_subverb_enum, "Unknown (%u)"));
-        if (return_code == 0)
+        if (return_code == 0 && msg_length > 0)
         {
             switch (subverb) {
             case 0:             /* Fragmented Ping */