Ethereal-dev: Re: [Ethereal-dev] Patch for GTP 1.64

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 16 Oct 2003 00:57:34 -0700
On Thu, Oct 16, 2003 at 09:08:15AM +0200, Michal.Melerowicz@xxxxxxxxx wrote:
> Next patch for GTP: it merges two dissectors (gtpv0, gtpv1) into one: gtp. 

In "dissect_gtp()", there's a big section

	if (tree) {

		...

	}

that sets "offset", and, then, after it, there's a section that does

	if ((gtp_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {

		if (gtp_prime)
			offset = 6;
		else
		if (gtp_version == 1) {
			if (gtp_hdr.flags & 0x07)  {
				if (tvb_get_guint8 (tvb, offset - 1))
					offset = 11;	/* if next_hdr != 0 */
				else
					offset = 12;
			}
			else 
				offset = 8;
		}
		else
			offset = 20;

which depends on "offset" already being set, with the "tvb_get_guint8()"
call; however, it's only going to be set if "tree" is non-null.