diff options
author | Anders Broman <anders.broman@ericsson.com> | 2008-09-27 14:16:55 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2008-09-27 14:16:55 +0000 |
commit | 3a26e893623658981bc8c22860f513faad738747 (patch) | |
tree | c076e875d86e659acbb2eec1697255df0d00b8a2 | |
parent | 69336f7d96e4939e5645926c912151b325f365ea (diff) |
From Reinhard(rspmn):
Wrong display of USSD strings in the GSM 7-bit alphabet for non-ASCII data
svn path=/trunk/; revision=26286
-rw-r--r-- | asn1/gsmmap/gsmmap.cnf | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_map.c | 46 |
2 files changed, 33 insertions, 29 deletions
diff --git a/asn1/gsmmap/gsmmap.cnf b/asn1/gsmmap/gsmmap.cnf index 471300a223..0202674671 100644 --- a/asn1/gsmmap/gsmmap.cnf +++ b/asn1/gsmmap/gsmmap.cnf @@ -418,8 +418,10 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; guint8 out_len; /* XXX - The maximum item label length is 240. Does this really need to be 1024? * use ep_alloc ? + * We need a input and an output buffer to gsm_sms_char_ascii_decode() */ - static unsigned char bigbuf[1024]; + static unsigned char msgbuf[1024]; + static unsigned char outbuf[1024]; gchar *utf8_text = NULL; GIConv cd; GError *l_conv_error = NULL; @@ -432,14 +434,14 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; switch(sms_encoding){ case SMS_ENCODING_7BIT: case SMS_ENCODING_7BIT_LANG: - out_len = gsm_sms_char_7bit_unpack(0, length, sizeof(bigbuf), + out_len = gsm_sms_char_7bit_unpack(0, length, sizeof(msgbuf), tvb_get_ptr(parameter_tvb, 0, length), - bigbuf); + msgbuf); - bigbuf[out_len] = '\0'; - gsm_sms_char_ascii_decode(bigbuf, bigbuf, out_len); - bigbuf[1023] = '\0'; - proto_tree_add_text(tree, parameter_tvb, 0, length, "USSD String: %%s", bigbuf); + msgbuf[out_len] = '\0'; + gsm_sms_char_ascii_decode(outbuf, msgbuf, out_len); + msgbuf[1023] = '\0'; + proto_tree_add_text(tree, parameter_tvb, 0, length, "USSD String: %%s", outbuf); break; case SMS_ENCODING_8BIT: proto_tree_add_text(tree, parameter_tvb , 0, length, "USSD String: %%s", tvb_get_ptr(parameter_tvb, 0, length)); diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c index c7539b5c1b..9dfb4c390c 100644 --- a/epan/dissectors/packet-gsm_map.c +++ b/epan/dissectors/packet-gsm_map.c @@ -2968,7 +2968,7 @@ static const ber_sequence_t gsm_map_ExternalSignalInfo_sequence[] = { static int dissect_gsm_map_ExternalSignalInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 626 "gsmmap.cnf" +#line 628 "gsmmap.cnf" guint8 octet; guint8 length; tvbuff_t *next_tvb; @@ -3242,7 +3242,7 @@ dissect_gsm_map_HLR_List(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse int dissect_gsm_map_GlobalCellId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 664 "gsmmap.cnf" +#line 666 "gsmmap.cnf" tvbuff_t *parameter_tvb; proto_tree *subtree; @@ -3508,7 +3508,7 @@ dissect_gsm_map_CellGlobalIdOrServiceAreaIdFixedLength(gboolean implicit_tag _U_ int dissect_gsm_map_LAIFixedLength(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 564 "gsmmap.cnf" +#line 566 "gsmmap.cnf" tvbuff_t *parameter_tvb; proto_tree *subtree; @@ -3791,7 +3791,7 @@ dissect_gsm_map_ss_ForwardingOptions(gboolean implicit_tag _U_, tvbuff_t *tvb _U offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); -#line 471 "gsmmap.cnf" +#line 473 "gsmmap.cnf" proto_tree_add_item(tree, hf_gsm_map_notification_to_forwarding_party, tvb, 0,1,FALSE); proto_tree_add_item(tree, hf_gsm_map_redirecting_presentation, tvb, 0,1,FALSE); @@ -4143,8 +4143,10 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int guint8 out_len; /* XXX - The maximum item label length is 240. Does this really need to be 1024? * use ep_alloc ? + * We need a input and an output buffer to gsm_sms_char_ascii_decode() */ - static unsigned char bigbuf[1024]; + static unsigned char msgbuf[1024]; + static unsigned char outbuf[1024]; gchar *utf8_text = NULL; GIConv cd; GError *l_conv_error = NULL; @@ -4159,14 +4161,14 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int switch(sms_encoding){ case SMS_ENCODING_7BIT: case SMS_ENCODING_7BIT_LANG: - out_len = gsm_sms_char_7bit_unpack(0, length, sizeof(bigbuf), + out_len = gsm_sms_char_7bit_unpack(0, length, sizeof(msgbuf), tvb_get_ptr(parameter_tvb, 0, length), - bigbuf); + msgbuf); - bigbuf[out_len] = '\0'; - gsm_sms_char_ascii_decode(bigbuf, bigbuf, out_len); - bigbuf[1023] = '\0'; - proto_tree_add_text(tree, parameter_tvb, 0, length, "USSD String: %s", bigbuf); + msgbuf[out_len] = '\0'; + gsm_sms_char_ascii_decode(outbuf, msgbuf, out_len); + msgbuf[1023] = '\0'; + proto_tree_add_text(tree, parameter_tvb, 0, length, "USSD String: %s", outbuf); break; case SMS_ENCODING_8BIT: proto_tree_add_text(tree, parameter_tvb , 0, length, "USSD String: %s", tvb_get_ptr(parameter_tvb, 0, length)); @@ -6491,7 +6493,7 @@ dissect_gsm_map_ms_VLR_Capability(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int dissect_gsm_map_ms_GSN_Address(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 528 "gsmmap.cnf" +#line 530 "gsmmap.cnf" tvbuff_t *parameter_tvb; guint8 octet; @@ -7126,7 +7128,7 @@ dissect_gsm_map_ms_UpdateGprsLocationRes(gboolean implicit_tag _U_, tvbuff_t *tv static int dissect_gsm_map_ms_IntegrityProtectionInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 600 "gsmmap.cnf" +#line 602 "gsmmap.cnf" tvbuff_t *parameter_tvb; asn1_ctx_t asn1_ctx; @@ -7149,7 +7151,7 @@ dissect_gsm_map_ms_IntegrityProtectionInformation(gboolean implicit_tag _U_, tvb static int dissect_gsm_map_ms_EncryptionInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 612 "gsmmap.cnf" +#line 614 "gsmmap.cnf" tvbuff_t *parameter_tvb; asn1_ctx_t asn1_ctx; @@ -7234,7 +7236,7 @@ dissect_gsm_map_ms_AllowedUMTS_Algorithms(gboolean implicit_tag _U_, tvbuff_t *t static int dissect_gsm_map_ms_RadioResourceInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 576 "gsmmap.cnf" +#line 578 "gsmmap.cnf" tvbuff_t *parameter_tvb; proto_tree *subtree; @@ -7305,7 +7307,7 @@ dissect_gsm_map_ms_BSSMAP_ServiceHandover(gboolean implicit_tag _U_, tvbuff_t *t static int dissect_gsm_map_ms_RANAP_ServiceHandover(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 588 "gsmmap.cnf" +#line 590 "gsmmap.cnf" tvbuff_t *parameter_tvb; asn1_ctx_t asn1_ctx; @@ -8039,7 +8041,7 @@ static int dissect_gsm_map_ms_T_forwardingOptions(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_gsm_map_ms_Ext_ForwOptions(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 477 "gsmmap.cnf" +#line 479 "gsmmap.cnf" proto_tree_add_item(tree, hf_gsm_map_notification_to_forwarding_party, tvb, 0,1,FALSE); proto_tree_add_item(tree, hf_gsm_map_redirecting_presentation, tvb, 0,1,FALSE); @@ -9234,7 +9236,7 @@ dissect_gsm_map_ms_ContextId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o static int dissect_gsm_map_ms_PDP_Type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 485 "gsmmap.cnf" +#line 487 "gsmmap.cnf" guint8 pdp_type_org; tvbuff_t *parameter_tvb; @@ -9277,7 +9279,7 @@ dissect_gsm_map_ms_PDP_Address(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int int dissect_gsm_map_ms_QoS_Subscribed(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 507 "gsmmap.cnf" +#line 509 "gsmmap.cnf" tvbuff_t *parameter_tvb; @@ -9309,7 +9311,7 @@ dissect_gsm_map_ms_APN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset int dissect_gsm_map_ms_Ext_QoS_Subscribed(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 518 "gsmmap.cnf" +#line 520 "gsmmap.cnf" tvbuff_t *parameter_tvb; @@ -10475,7 +10477,7 @@ dissect_gsm_map_ms_SubscriberState(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int dissect_gsm_map_ms_RAIdentity(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 552 "gsmmap.cnf" +#line 554 "gsmmap.cnf" tvbuff_t *parameter_tvb; proto_tree *subtree; @@ -12787,7 +12789,7 @@ dissect_gsm_map_lcs_ProvideSubscriberLocation_Arg(gboolean implicit_tag _U_, tvb int dissect_gsm_map_lcs_Ext_GeographicalInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 676 "gsmmap.cnf" +#line 678 "gsmmap.cnf" tvbuff_t *parameter_tvb; proto_tree *subtree; |