Ethereal-dev: Re: [ethereal-dev] Fix: malformed ISAKMP packets cause infinite loop in parse
The patch was line-wrapped, which meant I had to undo the line-wrapping
in order to get the patch to apply; for example
> Index: packet-isakmp.c
> ===================================================================
> RCS file: /cvsroot/ethereal/packet-isakmp.c,v
> retrieving revision 1.28
> diff -u -r1.28 packet-isakmp.c
> - --- packet-isakmp.c 2000/10/03 22:49:37 1.28
> +++ packet-isakmp.c 2000/10/05 14:13:02
> @@ -552,6 +552,7 @@
>
> struct trans_hdr * hdr = (struct trans_hdr *)(pd + offset);
> guint16 length = pntohs(&hdr->length);
> + int slength;
> proto_item * ti = proto_tree_add_text(tree, NullTVB, offset, length,
> "Transform payload");
> proto_tree * ntree;
should have been
> Index: packet-isakmp.c
> ===================================================================
> RCS file: /cvsroot/ethereal/packet-isakmp.c,v
> retrieving revision 1.28
> diff -u -r1.28 packet-isakmp.c
> - --- packet-isakmp.c 2000/10/03 22:49:37 1.28
> +++ packet-isakmp.c 2000/10/05 14:13:02
> @@ -552,6 +552,7 @@
>
> struct trans_hdr * hdr = (struct trans_hdr *)(pd + offset);
> guint16 length = pntohs(&hdr->length);
> + int slength;
> proto_item * ti = proto_tree_add_text(tree, NullTVB, offset, length, "Transform payload");
> proto_tree * ntree;
In addition, you change
length -= sizeof(*hdr);
to
slength -= sizeof(*hdr);
without having set "slength" first; GCC complains about this:
packet-isakmp.c: In function `dissect_transform':
packet-isakmp.c:555: warning: `slength' might be used uninitialized in
this function
packet-isakmp.c: In function `dissect_config':
packet-isakmp.c:1052: warning: `slength' might be used uninitialized in
this function