Ethereal-dev: [Ethereal-dev] Extra check in field array registration [PATCH]

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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 2 Dec 2005 00:45:04 +0100 (CET)
Hi list,

When I tried the help menu option Supported Protocols it bombed on me. :/
I was running Ethereal with some extra plugins on Win32. Debugging my way
out of it I found that some hf_register_info blurbs were NULL i.s.o. "".
There seems to be no check on this when registering the field array. The
attached patch to proto.c solves this. The other patch is for the
developer manual, to change an example using NULL blurbs.

Thanx,
Jaap

Index: EDG_chapter_dissection.xml
===================================================================
--- EDG_chapter_dissection.xml	(revision 16644)
+++ EDG_chapter_dissection.xml	(working copy)
@@ -938,32 +938,33 @@
 static hf_register_info hf[] = 
 {
 ...
-{&hf_msg_fragments,
-	{"Message fragments", "msg.fragments",
-	FT_NONE, BASE_NONE, NULL, 0x00,	NULL, HFILL } },
-{&hf_msg_fragment,
-	{"Message fragment", "msg.fragment",
-	FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
-{&hf_msg_fragment_overlap,
-	{"Message fragment overlap", "msg.fragment.overlap",
-	FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
-{&hf_msg_fragment_overlap_conflicts,
-	{"Message fragment overlapping with conflicting data",
-	"msg.fragment.overlap.conflicts",
-	FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
-{&hf_msg_fragment_multiple_tails,
-	{"Message has multiple tail fragments",
-	"msg.fragment.multiple_tails", 
-	FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
-{&hf_msg_fragment_too_long_fragment,
-	{"Message fragment too long", "msg.fragment.too_long_fragment",
-	FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL } },
-{&hf_msg_fragment_error,
-	{"Message defragmentation error", "msg.fragment.error",
-	FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
-{&hf_msg_reassembled_in,
-	{"Reassembled in", "msg.reassembled.in",
-	FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } },
+    /* Fragment entries */
+    { &hf_msg_fragments,
+      { "Message fragments", "msg.fragments", FT_NONE, BASE_NONE,
+        NULL, 0x00, "Message fragments", HFILL } },
+    { &hf_msg_fragment,
+      { "Message fragment", "msg.fragment", FT_FRAMENUM, BASE_NONE,
+        NULL, 0x00, "Message fragment", HFILL } },
+    { &hf_msg_fragment_overlap,
+      { "Message fragment overlap", "msg.fragment.overlap", FT_BOOLEAN, BASE_NONE,
+         NULL, 0x00, "Message fragment overlap", HFILL } },
+    { &hf_msg_fragment_overlap_conflicts,
+      { "Message fragment overlapping with conflicting data",
+        "msg.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE,
+        NULL, 0x00, "Message fragment overlapping with conflicting data", HFILL } },
+    { &hf_msg_fragment_multiple_tails,
+      { "Message has multiple tail fragments",
+        "msg.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE,
+        NULL, 0x00, "Message has multiple tail fragments", HFILL } },
+    { &hf_msg_fragment_too_long_fragment,
+      { "Message fragment too long", "msg.fragment.too_long_fragment", FT_BOOLEAN, BASE_NONE, 
+        NULL, 0x00, "Message fragment too long", HFILL } },
+    { &hf_msg_fragment_error,
+      { "Message defragmentation error", "msg.fragment.error", FT_FRAMENUM, BASE_NONE,
+        NULL, 0x00, "Message defragmentation error", HFILL } },
+    { &hf_msg_reassembled_in,
+      { "Reassembled in", "msg.reassembled.in", FT_FRAMENUM, BASE_NONE,
+        NULL, 0x00, "Reassembled in", HFILL } },
 ...
 static gint *ett[] = 
 {
Index: proto.c
===================================================================
--- proto.c	(revision 16644)
+++ proto.c	(working copy)
@@ -3099,6 +3099,7 @@
 	/* The field must have names */
 	DISSECTOR_ASSERT(hfinfo->name);
 	DISSECTOR_ASSERT(hfinfo->abbrev);
+	DISSECTOR_ASSERT(hfinfo->blurb);
 
 	/* These types of fields are allowed to have value_strings, true_false_strings or a protocol_t struct*/
 	DISSECTOR_ASSERT((hfinfo->strings == NULL) || (