diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-10-25 21:09:36 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-10-25 21:09:36 +0000 |
commit | a863264fb2d3da6d3db86f4a7bef1f3a24e224f9 (patch) | |
tree | 0365a560da4cba7fc4e5e014026f77adbc305a75 /packet-telnet.c | |
parent | fdcbffe3c7eabf9f196f9457865a5c8d23233b67 (diff) |
Correctly handle the "no IAC found" case in "telnet_sub_option()".
Handle the "unknown command" case in "telnet_command()".
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6507 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-telnet.c')
-rw-r--r-- | packet-telnet.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packet-telnet.c b/packet-telnet.c index 238a509968..6c44d58755 100644 --- a/packet-telnet.c +++ b/packet-telnet.c @@ -2,7 +2,7 @@ * Routines for telnet packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-telnet.c,v 1.32 2002/08/28 21:00:36 jmayer Exp $ + * $Id: packet-telnet.c,v 1.33 2002/10/25 21:09:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -120,6 +120,7 @@ telnet_sub_option(proto_tree *telnet_tree, tvbuff_t *tvb, int start_offset) guint8 opt_byte; int subneg_len, req; const guchar *opt; + int iac_offset; guint len; offset += 2; /* skip IAC and SB */ @@ -136,11 +137,12 @@ telnet_sub_option(proto_tree *telnet_tree, tvbuff_t *tvb, int start_offset) /* Search for an IAC. */ len = tvb_length_remaining(tvb, offset); - offset = tvb_find_guint8(tvb, offset, len, TN_IAC); + iac_offset = tvb_find_guint8(tvb, offset, len, TN_IAC); if (offset == -1) { /* None found - run to the end of the packet. */ offset += len; - } + } else + offset = iac_offset; subneg_len = offset - start_offset; @@ -286,6 +288,11 @@ telnet_command(proto_tree *telnet_tree, tvbuff_t *tvb, int start_offset) offset = telnet_will_wont_do_dont(telnet_tree, tvb, start_offset, "Don't"); break; + + default: + proto_tree_add_text(telnet_tree, tvb, start_offset, 2, + "Command: Unknown (0x%02x)", optcode); + break; } return offset; |