Todd Sabin <tsabin@xxxxxxxxxxxxx> writes:
> Guy Harris <gharris@xxxxxxxxx> writes:
> > On Mon, Feb 11, 2002 at 03:09:10PM +1100, Ronnie Sahlberg wrote:
> > > Todd,
> > > the ep* capture shows SAMR running atop UDP, but in the SAMR packets, there
> > > are some 20 extra bytes remaining after the SAMR
> > > PDU, are these ethernet trailers or is it used to authenticate the DCERPC
> > > pdu?
> > > They are not dissected anyway.
>[...]
> > packet, is dissected by the SAMR dissector as 24 bytes, ending at the
> > access mask field.
> > [...]
> > (Should DCE RPC use the fragment length to set the length of the tvbuff
> > it hands to the subdissector?)
>
> Yes. The connection oriented side does that already. The
> connectionless should as well. I'll try to send a patch in a day or
> so, if someone doesn't fix it first.
Ok, so "day or so" was slightly inaccurate :), but here's the patch.
Todd
RCS file: /cvsroot/ethereal/packet-dcerpc.c,v
retrieving revision 1.41
diff -u -r1.41 packet-dcerpc.c
--- packet-dcerpc.c 2002/03/19 11:10:40 1.41
+++ packet-dcerpc.c 2002/03/20 23:33:52
@@ -1899,6 +1899,7 @@
*/
switch (hdr.ptype) {
+ int length, reported_length, stub_length;
dcerpc_info di;
dcerpc_call_value *value, v;
@@ -1938,14 +1939,24 @@
value = &v;
}
+ length = tvb_length_remaining (tvb, offset);
+ reported_length = tvb_reported_length_remaining (tvb, offset);
+ stub_length = hdr.frag_len;
+ if (length > stub_length)
+ length = stub_length;
+ if (reported_length > stub_length)
+ reported_length = stub_length;
+
di.conv = conv;
di.call_id = hdr.seqnum;
di.smb_fid = -1;
di.request = TRUE;
di.call_data = value;
- dcerpc_try_handoff (pinfo, tree, dcerpc_tree, tvb, offset,
- hdr.opnum, TRUE, hdr.drep, &di);
+ dcerpc_try_handoff (pinfo, tree, dcerpc_tree,
+ tvb_new_subset (tvb, offset, length,
+ reported_length),
+ 0, hdr.opnum, TRUE, hdr.drep, &di);
break;
case PDU_RESP:
if(!(pinfo->fd->flags.visited)){
@@ -1975,14 +1986,24 @@
value = &v;
}
+ length = tvb_length_remaining (tvb, offset);
+ reported_length = tvb_reported_length_remaining (tvb, offset);
+ stub_length = hdr.frag_len;
+ if (length > stub_length)
+ length = stub_length;
+ if (reported_length > stub_length)
+ reported_length = stub_length;
+
di.conv = conv;
di.call_id = 0;
di.smb_fid = -1;
di.request = FALSE;
di.call_data = value;
- dcerpc_try_handoff (pinfo, tree, dcerpc_tree, tvb, offset,
- value->opnum, FALSE, hdr.drep, &di);
+ dcerpc_try_handoff (pinfo, tree, dcerpc_tree,
+ tvb_new_subset (tvb, offset, length,
+ reported_length),
+ 0, value->opnum, FALSE, hdr.drep, &di);
break;
}