aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ndmp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-10-06 09:59:50 +0000
committerGuy Harris <guy@alum.mit.edu>2004-10-06 09:59:50 +0000
commit776280fa0d2ef480ec10cc6744e6ab31985c3c54 (patch)
tree7958a73f55c802506acfb947c0b842b350ebe6bc /epan/dissectors/packet-ndmp.c
parentfdd1b1dba586eaff12487ff166d576a80b84ce67 (diff)
Properly reject packets that don't look like NDMP packets.
svn path=/trunk/; revision=12216
Diffstat (limited to 'epan/dissectors/packet-ndmp.c')
-rw-r--r--epan/dissectors/packet-ndmp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c
index eb16e496ba..fa8fbe3c69 100644
--- a/epan/dissectors/packet-ndmp.c
+++ b/epan/dissectors/packet-ndmp.c
@@ -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);
}