Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] [PATCH] IAX2 dissector crash

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Thu, 10 Feb 2005 01:29:35 -0800
Artur Zaprzala wrote:
Ethereal 0.10.8 is crashing on `NEW' packets from IAX2 protocol. Attached patch corrects the problem, but I don't know the sources enough to be sure if this patch targets actual bug or only its symptoms.


Artur Zaprzala


------------------------------------------------------------------------

--- packet-iax2.c-orig	2004-12-14 20:53:55.000000000 +0100
+++ packet-iax2.c	2005-01-10 00:30:18.619617504 +0100
@@ -1201,7 +1201,8 @@
       /* if this is a data call, set up a subdissector for the circuit */
       dissector_handle_t s;
       s = dissector_get_port_handle(iax2_dataformat_dissector_table, iax_call -> dataformat );
-      circuit_set_dissector( circuit, s );
+      if (s!=NULL)
+	circuit_set_dissector( circuit, s );
     }

"circuit_set_dissector()" doesn't itself dereference the pointer passed to it as the second argument, it just sets the circuit's "dissector_handle" to that argument - and a newly-created circuit has a null value for "dissector_handle", so if s is null "circuit_set_dissector" shouldn't do anything...

...unless "circuit" *itself* is null, in which case it'll crash on most platforms - however, that statement is inside an "if" that tests whether "circuit" is null, so that shouldn't be a problem - *or* if "circuit" has a bogus value, in which case it might crash.

It's not guaranteed that "circuit" is set, so that's probably the problem. I'll check in a change to set it to null in the cases where it's not set (and do the same for "reversed").