aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-telnet.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2005-05-30 21:04:58 +0000
committerGerald Combs <gerald@wireshark.org>2005-05-30 21:04:58 +0000
commitfe89e3d6404cf76a21bd54cad23be0c89445b1c3 (patch)
tree264492dc95e4f4d808947e66add3bb5dd93ca2fb /epan/dissectors/packet-telnet.c
parentbcd1c5b9fab7c97b644eb780932d874f69dbb1b4 (diff)
Don't try to check the suboption length type if we don't have a suboption.
Found by Steve Grubb. Fixes part of bug 217. svn path=/trunk/; revision=14499
Diffstat (limited to 'epan/dissectors/packet-telnet.c')
-rw-r--r--epan/dissectors/packet-telnet.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/epan/dissectors/packet-telnet.c b/epan/dissectors/packet-telnet.c
index 06c6405199..404991e14a 100644
--- a/epan/dissectors/packet-telnet.c
+++ b/epan/dissectors/packet-telnet.c
@@ -1224,37 +1224,39 @@ telnet_sub_option(packet_info *pinfo, proto_tree *telnet_tree, tvbuff_t *tvb, in
subneg_len -= 3;
if (subneg_len > 0) {
- switch (options[opt_byte].len_type) {
- case NO_LENGTH:
- /* There isn't supposed to *be* sub-option negotiation for this. */
- proto_tree_add_text(option_tree, tvb, start_offset, subneg_len,
- "Bogus suboption data");
- return offset;
-
- case FIXED_LENGTH:
- /* Make sure the length is what it's supposed to be. */
- if (subneg_len != options[opt_byte].optlen) {
- proto_tree_add_text(option_tree, tvb, start_offset, subneg_len,
- "Suboption parameter length is %d, should be %d",
- subneg_len, options[opt_byte].optlen);
- return offset;
- }
- break;
+ /* Now dissect the suboption parameters. */
+ if (dissect != NULL) {
- case VARIABLE_LENGTH:
- /* Make sure the length is greater than the minimum. */
- if (subneg_len < options[opt_byte].optlen) {
- proto_tree_add_text(option_tree, tvb, start_offset, subneg_len,
- "Suboption parameter length is %d, should be at least %d",
- subneg_len, options[opt_byte].optlen);
- return offset;
+ switch (options[opt_byte].len_type) {
+
+ case NO_LENGTH:
+ /* There isn't supposed to *be* sub-option negotiation for this. */
+ proto_tree_add_text(option_tree, tvb, start_offset, subneg_len,
+ "Bogus suboption data");
+ return offset;
+
+ case FIXED_LENGTH:
+ /* Make sure the length is what it's supposed to be. */
+ if (subneg_len != options[opt_byte].optlen) {
+ proto_tree_add_text(option_tree, tvb, start_offset, subneg_len,
+ "Suboption parameter length is %d, should be %d",
+ subneg_len, options[opt_byte].optlen);
+ return offset;
+ }
+ break;
+
+ case VARIABLE_LENGTH:
+ /* Make sure the length is greater than the minimum. */
+ if (subneg_len < options[opt_byte].optlen) {
+ proto_tree_add_text(option_tree, tvb, start_offset, subneg_len,
+ "Suboption parameter length is %d, should be at least %d",
+ subneg_len, options[opt_byte].optlen);
+ return offset;
+ }
+ break;
}
- break;
- }
- /* Now dissect the suboption parameters. */
- if (dissect != NULL) {
/* We have a dissector for this suboption's parameters; call it. */
(*dissect)(pinfo, opt, tvb, start_offset, subneg_len, option_tree);
} else {