aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gtpv2.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2010-09-03 17:10:52 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2010-09-03 17:10:52 +0000
commit72f176d080985cd25f920d100a9ecf8b18b13b20 (patch)
treea239e87d3019d1c08b8a007781d78889a89c804f /epan/dissectors/packet-gtpv2.c
parentcf72226640afe57b5108d9a2e217f3f9255a6b8d (diff)
GTPv2: IMSI is decoded improperly.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5179 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@34062 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-gtpv2.c')
-rw-r--r--epan/dissectors/packet-gtpv2.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c
index c8f38b6399..0ced4701ba 100644
--- a/epan/dissectors/packet-gtpv2.c
+++ b/epan/dissectors/packet-gtpv2.c
@@ -438,34 +438,15 @@ dissect_gtpv2_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, p
* That is, the overall length of the IE is 11 octets.
*/
-
-static gchar *imsi_to_str(const guint8 * ad)
-{
- static gchar str[17] = " ";
- int i, j = 0;
-
- for (i = 0; i < 8; i++)
- {
- if (((ad[i] >> 4) & 0x0F) <= 9)
- str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
- if ((ad[i] & 0x0F) <= 9)
- str[j++] = (ad[i] & 0x0F) + 0x30; /* Adding 0x30(48 decimal) makes it a printable digit (Eg. Ascii value 0f 9 is 57 (9+48))*/
-
- }
- str[j] = '\0';
-
- return str;
-}
-
static void
dissect_gtpv2_imsi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_,guint8 message_type _U_, guint8 instance _U_)
{
int offset= 0;
- guint8 imsi_val[8];
- gchar *imsi_str;
+ tvbuff_t *tvb_new;
+ const gchar *imsi_str;
- tvb_memcpy(tvb, imsi_val, offset , 8);
- imsi_str = imsi_to_str(imsi_val);
+ tvb_new = tvb_new_subset(tvb, offset, length, length);
+ imsi_str = unpack_digits(tvb, offset);
proto_tree_add_string(tree, hf_gtpv2_imsi, tvb, offset, length, imsi_str);
}