diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2014-08-06 19:50:06 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-07 06:49:10 +0000 |
commit | ccbe5fd0b9520493884de70056dbd9682647ab8d (patch) | |
tree | b88f4b23cdf8f519b005bc1f4b8ac868db92c5da /epan/dissectors/packet-mip6.c | |
parent | 378e8b71c0a0c6c3ddd3d0a9b4b088070864ab7d (diff) |
MIPv6: fix dissection of Service Selection Identifier
APN field is not encoded as a dotted string so the first character is not a length
Bug: 10323
Change-Id: Ia62137c785d505e9d0f1536a333b421a85480741
Reviewed-on: https://code.wireshark.org/review/3461
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mip6.c')
-rw-r--r-- | epan/dissectors/packet-mip6.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c index 396f90a666..7aaea58be3 100644 --- a/epan/dissectors/packet-mip6.c +++ b/epan/dissectors/packet-mip6.c @@ -1034,6 +1034,8 @@ static int hf_mip6_vsm_vid = -1; static int hf_mip6_vsm_subtype = -1; static int hf_mip6_vsm_subtype_3gpp = -1; +static int hf_mip6_opt_ss_identifier = -1; + static int hf_mip6_opt_badff_spi = -1; static int hf_mip6_opt_badff_auth = -1; @@ -2213,15 +2215,13 @@ dissect_mip6_opt_vsm(const mip6_opt *optp _U_, tvbuff_t *tvb, int offset, } /* 20 Service Selection Mobility Option [RFC5149] */ -#define MAX_APN_LENGTH 100 static void dissect_mip6_opt_ssm(const mip6_opt *optp _U_, tvbuff_t *tvb, int offset, guint optlen, packet_info *pinfo _U_, proto_tree *opt_tree, proto_item *hdr_item _U_ ) { int len; - guint8 str[MAX_APN_LENGTH+1]; - int curr_len; + guint8 *str; /* offset points to tag(opt) */ offset++; @@ -2244,20 +2244,9 @@ dissect_mip6_opt_ssm(const mip6_opt *optp _U_, tvbuff_t *tvb, int offset, */ if (len > 0) { - /* init buffer and copy it */ - memset(str, 0, MAX_APN_LENGTH); - tvb_memcpy(tvb, str, offset, len<MAX_APN_LENGTH?len:MAX_APN_LENGTH); - - curr_len = 0; - while ((curr_len < len) && (curr_len < MAX_APN_LENGTH)) - { - guint step = str[curr_len]; - str[curr_len] = '.'; - curr_len += step+1; - } - /* High light bytes including the first lenght byte, excluded from str(str+1) */ - proto_tree_add_text(opt_tree, tvb, offset, len, "Identifier: %s", str+1); - proto_item_append_text(hdr_item, ": %s", str+1); + str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len, ENC_UTF_8|ENC_NA); + proto_tree_add_string(opt_tree, hf_mip6_opt_ss_identifier, tvb, offset, len, str); + proto_item_append_text(hdr_item, ": %s", str); } } @@ -4219,6 +4208,11 @@ proto_register_mip6(void) FT_UINT8, BASE_DEC | BASE_EXT_STRING, &mip6_vsm_subtype_3gpp_value_ext, 0, NULL, HFILL } }, + { &hf_mip6_opt_ss_identifier, + { "Identifier", "mip6.ss.identifier", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_mip6_opt_badff_spi, { "SPI", "mip6.badff.spi", FT_UINT32, BASE_DEC, NULL, 0x0, |