Properly reject packets that don't look like NDMP packets.

svn path=/trunk/; revision=12216
This commit is contained in:
Guy Harris 2004-10-06 09:59:50 +00:00
parent fdd1b1dba5
commit 776280fa0d
1 changed files with 9 additions and 4 deletions

View File

@ -2754,7 +2754,7 @@ dissect_ndmp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return TRUE;
}
static void
static int
dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset = 0;
@ -2768,23 +2768,28 @@ dissect_ndmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
len = dissect_rpc_fragment(tvb, offset, pinfo, tree,
dissect_ndmp_message, FALSE, proto_ndmp, ett_ndmp,
ndmp_defragment, first_pdu);
first_pdu = FALSE;
if (len < 0) {
/*
* We need more data from the TCP stream for
* this fragment.
*/
return;
return tvb_length(tvb);
}
if (len == 0) {
/*
* It's not NDMP. Stop processing.
* Return a "this isn't NDMP" indication
* if this is the first PDU.
*/
if (first_pdu)
return 0;
break;
}
first_pdu = FALSE;
offset += len;
}
return tvb_length(tvb);
}
void
@ -3489,6 +3494,6 @@ proto_reg_handoff_ndmp(void)
{
dissector_handle_t ndmp_handle;
ndmp_handle = create_dissector_handle(dissect_ndmp, proto_ndmp);
ndmp_handle = new_create_dissector_handle(dissect_ndmp, proto_ndmp);
dissector_add("tcp.port",TCP_PORT_NDMP, ndmp_handle);
}