diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-05-08 19:46:32 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-05-08 19:46:32 +0000 |
commit | 4b244a4b8700ea5ed30122e989577e15b05f6c32 (patch) | |
tree | c78ef6199e11951c6d383c1d70e7d5f1f06df9b8 | |
parent | 160d3aa042c30d7b47e58cfc3205db2a5da7e25b (diff) |
Additional LDAP checks for invalid packets, from Scott Renfro.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3404 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | AUTHORS | 4 | ||||
-rw-r--r-- | doc/ethereal.pod.template | 1 | ||||
-rw-r--r-- | packet-ldap.c | 25 |
3 files changed, 25 insertions, 5 deletions
@@ -607,6 +607,10 @@ Michael Rozhavsky <mike@tochna.technion.ac.il> { Additional OSPF LSA types and opaque-options flag } +Scott Renfro <scott@renfro.org> { + LDAP checks for invalid packets +} + Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to give his permission to use his version of snprintf.c. diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index a12466e9b5..5318bd318c 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -1100,6 +1100,7 @@ B<http://www.ethereal.com>. Riaan Swart <rswart@cs.sun.ac.za> Christian Lacunza <celacunza@gmx.net> Michael Rozhavsky <mike@tochna.technion.ac.il> + Scott Renfro <scott@renfro.org> Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to give his permission to use his version of snprintf.c. diff --git a/packet-ldap.c b/packet-ldap.c index 9b239a85d8..7b18a9579a 100644 --- a/packet-ldap.c +++ b/packet-ldap.c @@ -1,7 +1,7 @@ /* packet-ldap.c * Routines for ldap packet dissection * - * $Id: packet-ldap.c,v 1.24 2001/04/15 07:35:26 guy Exp $ + * $Id: packet-ldap.c,v 1.25 2001/05/08 19:46:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -804,6 +804,9 @@ static int dissect_ldap_request_compare(ASN1_SCK *a, proto_tree *tree) read_string(a, 0, -1, 0, &string1, ASN1_UNI, ASN1_OTS); read_string(a, 0, -1, 0, &string2, ASN1_UNI, ASN1_OTS); + if (string1 == 0 && string2 == 0) /* read_string failed */ + return 1; + length = 2 + strlen(string1) + strlen(string2); compare = g_malloc0(length); snprintf(compare, length, "%s=%s", string1, string2); @@ -882,6 +885,11 @@ dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int first_time = 1; int ret; + if (check_col(pinfo->fd, COL_PROTOCOL)) + col_set_str(pinfo->fd, COL_PROTOCOL, "LDAP"); + if (check_col(pinfo->fd, COL_INFO)) + col_clear(pinfo->fd, COL_INFO); + if (tree) { ti = proto_tree_add_item(tree, proto_ldap, tvb, offset, tvb_length(tvb), @@ -900,13 +908,23 @@ dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_start = a.offset; if (read_sequence(&a, &messageLength)) { + if (check_col(pinfo->fd, COL_INFO)) + col_set_str(pinfo->fd, COL_INFO, "Invalid LDAP packet"); if (ldap_tree) proto_tree_add_text(ldap_tree, tvb, offset, 1, "Invalid LDAP packet"); break; } message_id_start = a.offset; - read_integer(&a, 0, -1, 0, &messageId, ASN1_INT); + if (read_integer(&a, 0, -1, 0, &messageId, ASN1_INT)) + { + if (check_col(pinfo->fd, COL_INFO)) + col_set_str(pinfo->fd, COL_INFO, "Invalid LDAP packet (No Message ID)"); + if (ldap_tree) + proto_tree_add_text(ldap_tree, tvb, message_id_start, 1, + "Invalid LDAP packet (No Message ID)"); + break; + } message_id_length = a.offset - message_id_start; start = a.offset; @@ -918,9 +936,6 @@ dissect_ldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (first_time) { - if (check_col(pinfo->fd, COL_PROTOCOL)) - col_set_str(pinfo->fd, COL_PROTOCOL, "LDAP"); - if (check_col(pinfo->fd, COL_INFO)) col_add_fstr(pinfo->fd, COL_INFO, "MsgId=%u MsgType=%s", messageId, typestr); |