aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-tpncp.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2012-02-27 16:43:18 +0000
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2012-02-27 16:43:18 +0000
commitd97f729ae3156124f3ebafc77720c9c734a738f5 (patch)
tree77debd9d2c49fe4ce05ac45b8698b33bcac30f18 /epan/dissectors/packet-tpncp.c
parentec778bd8f5b31f0a10ff05c1ecffbd41d3513002 (diff)
From Alex Rodikov via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6871
TPNCP (proprietary Audiocodes) protocol dessector - wrong guint8 value presentation The presentation of unsigned 8-bit integer is wrong. The (signed) gint8 is used which is displayed as unsigned integer (by proto_tree_add_uint) afterwards. That causes wrong presentation of valus which bigger than 127. Solution: New guint8 is introduced to present unsigned 8 bit integer value. svn path=/trunk/; revision=41209
Diffstat (limited to 'epan/dissectors/packet-tpncp.c')
-rw-r--r--epan/dissectors/packet-tpncp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c
index f3d88fa72a..8e77c3b471 100644
--- a/epan/dissectors/packet-tpncp.c
+++ b/epan/dissectors/packet-tpncp.c
@@ -139,6 +139,7 @@ static void dissect_tpncp_data(gint data_id, tvbuff_t *tvb, proto_item *item,
gint16 g_short;
guint16 g_ushort;
gint8 g_char;
+ guint8 g_uchar;
gchar *g_str = NULL;
gint g_str_len, counter, bitshift, bitmask;
tpncp_data_field_info *current_tpncp_data_field_info = NULL;
@@ -161,21 +162,23 @@ static void dissect_tpncp_data(gint data_id, tvbuff_t *tvb, proto_item *item,
g_free(g_str);
}
else { /* add single char */
- g_char = tvb_get_guint8(tvb, *offset);
+ g_uchar = tvb_get_guint8(tvb, *offset);
/* bitfields */
if (current_tpncp_data_field_info->tpncp_data_field_size != 8) {
for (counter = 0, bitmask = 0x0, bitshift = bitindex;
counter < current_tpncp_data_field_info->tpncp_data_field_size;
counter++)
bitmask |= bits[bitindex++]; /* Bitmask of interesting bits. */
- g_char &= bitmask;
- g_char >>= bitshift;
+ g_uchar &= bitmask;
+ g_uchar >>= bitshift;
}
- if (current_tpncp_data_field_info->tpncp_data_field_sign) {
+ if (current_tpncp_data_field_info->tpncp_data_field_sign || current_tpncp_data_field_info->tpncp_data_field_size != 8) {
proto_tree_add_uint(ltree, current_tpncp_data_field_info->tpncp_data_field_descr,
- tvb, *offset, 1, g_char);
+ tvb, *offset, 1, g_uchar);
}
else {
+ /* signed*/
+ g_char = (gint8)g_uchar;
proto_tree_add_int(ltree, current_tpncp_data_field_info->tpncp_data_field_descr,
tvb, *offset, 1, g_char);
}