Ethereal-dev: [Ethereal-dev] a bug in PIM Address List option parser

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

From: SUZUKI Shinsuke <suz@xxxxxxxxxxxxxxxxx>
Date: Tue, 06 Jul 2004 19:35:24 +0900
Hello,

I've found a bug in PIM Address List option parser in packet-pim.c
(which was submitted by me, sorry).

Here's the patch to fix the bug.  So could anyone review and commit
it?  (Essentially, the addition of "break" at the end of "case 24:
case 65001:" is enough to fix the bug.  But I also changed the code to
use a subtree to denote address-list just for a better appearance)

Thanks,
----
SUZUKI, Shinsuke @ Hitachi / KAME Project


--- /usr/local/src/ethereal/packet-pim.c	Sat Dec 20 23:52:24 2003
+++ packet-pim.c	Sat Jul  3 02:29:55 2004
@@ -807,10 +807,15 @@
 		case 65001: /* address list (old implementations) */
 		{
 			int i;
-			proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len, 
+			proto_tree *sub_tree = NULL;
+			proto_item *addrlist_option;
+
+			addrlist_option = proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len,
 					    "%sAddress List (%u)",
 					    hello_opt == 65001 ? "old " : "",
                                             hello_opt);
+			sub_tree = proto_item_add_subtree(addrlist_option, ett_pim);
+
 			for (i = offset + 4; i < offset + 4 + opt_len; ) {
 				int advance;
 				const char *s;
@@ -818,10 +823,11 @@
 				s = dissect_pim_addr(tvb, i, pimv2_unicast, &advance);
 				if (s == NULL)
 					break;
-				proto_tree_add_text(pimopt_tree, tvb, offset, 
+				proto_tree_add_text(sub_tree, tvb, offset, 
 						    advance, "Address: %s", s);
 				i += advance;
 			}
+			break;
 		}
 		default:
 			proto_tree_add_text(pimopt_tree, tvb, offset, 4 + opt_len,