Ethereal-dev: Re: [ethereal-dev] ethereal 0.7.2 crashes when decoding SNMP packets

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 20 Aug 1999 11:39:29 -0700 (PDT)
> .. this is due to the lack of a call to
> init_mib() at the beginning of the program
> with the SNMP library I got (ucd-snmp coming
> with Linux RedHat 5.2). I added the init_mib
> as the very first line of the main and
> everything went fine...

I vaguely remember some other case where Ethereal crashed in the SNMP
decoding code, but I can't find anything obvious in my archives of
"ethereal-dev" and "ethereal-users", so I don't know if that means this
has already been fixed in the CVS tree, or that we never figured out
what it was and this might have been what it was, or what.

In any case, having "proto_register_snmp()" call "init_mib()" should
also work, and keeps "main()" from having to know about that
SNMP-specific detail; here's a patch to do that - could you check
whether doing it there rather than in "main()" also works, and let us
know if it does?

Index: packet-snmp.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-snmp.c,v
retrieving revision 1.6
diff -c -r1.6 packet-snmp.c
*** packet-snmp.c	1999/07/29 07:11:23	1.6
--- packet-snmp.c	1999/08/20 18:33:01
***************
*** 866,871 ****
--- 866,872 ----
                  { "Name",           "snmp.abbreviation", TYPE, VALS_POINTER }},
          };*/
  
+ 	init_mib();
          proto_snmp = proto_register_protocol("Simple Network Management Protocol", "snmp");
   /*       proto_register_field_array(proto_snmp, hf, array_length(hf));*/
  }