aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/nettrace_3gpp_32_423.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2019-01-11 14:13:25 +0100
committerAnders Broman <a.broman58@gmail.com>2019-01-11 14:22:56 +0000
commita58dd11ba08a674e58f07ec5be5f5f339f5d33e0 (patch)
treee4c710fa71a51bdd320e0145c06c4efe03a8b2b8 /wiretap/nettrace_3gpp_32_423.c
parentd6b187e42ff3124023ac36a22244367a5be60326 (diff)
nettrace: Fix missing tag length for IPV4_DST.
Change-Id: I00564adaef2922ff991887f0ee5c04a3c7307019 Reviewed-on: https://code.wireshark.org/review/31488 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap/nettrace_3gpp_32_423.c')
-rw-r--r--wiretap/nettrace_3gpp_32_423.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/wiretap/nettrace_3gpp_32_423.c b/wiretap/nettrace_3gpp_32_423.c
index 2cfd3b1f0a..9f1c570ad7 100644
--- a/wiretap/nettrace_3gpp_32_423.c
+++ b/wiretap/nettrace_3gpp_32_423.c
@@ -352,7 +352,6 @@ write_packet_data(wtap_dumper *wdh, wtap_rec *rec, int *err, gchar **err_info, g
int tag_str_len = 0;
int proto_str_len, dissector_table_str_len, raw_data_len, pkt_data_len, exp_pdu_tags_len, i, j;
guint8 *packet_buf;
- gchar chr;
gint val1, val2;
gboolean port_type_defined = FALSE;
gboolean use_proto_table = FALSE;
@@ -411,7 +410,7 @@ write_packet_data(wtap_dumper *wdh, wtap_rec *rec, int *err, gchar **err_info, g
}
/* Find the start of the raw data*/
curr_pos = strstr(next_pos, ">") + 1;
- next_pos = strstr(next_pos, "<");
+ next_pos = strstr(curr_pos, "<");
raw_data_len = (int)(next_pos - curr_pos);
@@ -589,6 +588,8 @@ write_packet_data(wtap_dumper *wdh, wtap_rec *rec, int *err, gchar **err_info, g
i++;
packet_buf[i] = 0;
i++;
+ packet_buf[i] = EXP_PDU_TAG_IPV4_DST_LEN; /* tag length */;
+ i++;
memcpy(packet_buf + i, exported_pdu_info->dst_ip, EXP_PDU_TAG_IPV4_DST_LEN);
i += EXP_PDU_TAG_IPV4_DST_LEN;
}
@@ -656,17 +657,23 @@ write_packet_data(wtap_dumper *wdh, wtap_rec *rec, int *err, gchar **err_info, g
/* Convert the hex raw msg data to binary and write to the packet buf*/
for (; i < (pkt_data_len + exp_pdu_tags_len); i++){
- chr = *curr_pos;
- val1 = g_ascii_xdigit_value(chr);
+ gchar chr1, chr2;
+
+ chr1 = *curr_pos;
+ val1 = g_ascii_xdigit_value(chr1);
curr_pos++;
- chr = *curr_pos;
- val2 = g_ascii_xdigit_value(chr);
+ chr2 = *curr_pos;
+ val2 = g_ascii_xdigit_value(chr2);
if ((val1 != -1) && (val2 != -1)){
packet_buf[i] = ((guint8)val1 * 16) + val2;
}
else{
/* Something wrong, bail out */
- *err_info = g_strdup("Could not parse hex data");
+ *err_info = g_strdup_printf("Could not parse hex data,bufzize %u index %u %c%c",
+ (pkt_data_len + exp_pdu_tags_len),
+ i,
+ chr1,
+ chr2);
*err = WTAP_ERR_BAD_FILE;
g_free(packet_buf);
return WTAP_OPEN_ERROR;