aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal@wireshark.org>2020-12-03 09:58:10 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2020-12-03 10:20:26 +0000
commit26220f8045a36b3d424f041a2eab6e477cd74f08 (patch)
treeabc27fd9de7fc30fa3b4fa096392299b6ba76689
parent11bccd9e399d88360e8201924a00d728d8541b83 (diff)
GMR-1 RR: revert g165b56afe7
We cannot use tvb_new_octet_aligned() for this GSM 7bits packed buffer. Moreover tvb_free() call not removed was leading to a double free attempt. Closes #17055
-rw-r--r--epan/dissectors/packet-gmr1_rr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/epan/dissectors/packet-gmr1_rr.c b/epan/dissectors/packet-gmr1_rr.c
index 8a84428adb..c549862366 100644
--- a/epan/dissectors/packet-gmr1_rr.c
+++ b/epan/dissectors/packet-gmr1_rr.c
@@ -634,15 +634,24 @@ static const value_string rr_pos_display_flag_vals[] = {
GMR1_IE_FUNC(gmr1_ie_rr_pos_display)
{
- gchar *txt_unpacked;
+ const unsigned char *txt_raw;
+ gchar *txt_packed, *txt_unpacked;
tvbuff_t *txt_packed_tvb;
+ int i;
/* Flag */
proto_tree_add_item(tree, hf_rr_pos_display_flag,
tvb, offset, 1, ENC_BIG_ENDIAN);
/* Get text in an aligned tvbuff */
- txt_packed_tvb = tvb_new_octet_aligned(tvb, 8*offset+4, 84);
+ /* Do not use tvb_new_octet_aligned(), GSM 7bit packing bit parsing
+ goes from LSB to MSB so a trick is applied here for the last byte */
+ txt_raw = tvb_get_ptr(tvb, offset, 11);
+ txt_packed = (gchar*)wmem_alloc(wmem_packet_scope(), 11);
+ for (i=0; i<10; i++)
+ txt_packed[i] = (txt_raw[i] << 4) | (txt_raw[i+1] >> 4);
+ txt_packed[10] = txt_raw[10];
+ txt_packed_tvb = tvb_new_real_data(txt_packed, 11, 11);
/* Unpack text */
txt_unpacked = tvb_get_ts_23_038_7bits_string_packed(wmem_packet_scope(), txt_packed_tvb, 0, 12);