diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-07-16 12:41:32 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-07-16 21:30:48 +0000 |
commit | 6a7b01255a95740900a402e1ac9d66ab771310da (patch) | |
tree | 486cfc6b1e9450741b4942dd306349c01f79f70c /epan/dissectors/packet-ipmi-trace.c | |
parent | 1e630b42e1f0573ca549643952017da315e695a0 (diff) |
Don't just grab raw string data with tvb_memcpy().
Use proto_tree_add_item...() routines to add strings; use
tvb_get_string_enc() to extract strings. That way, all strings are
fetched using an encoding value, to properly map to UTF-8.
Change-Id: I2118e812965cfad5d8c288ea40fa50aca9c67fa8
Reviewed-on: https://code.wireshark.org/review/33970
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-ipmi-trace.c')
-rw-r--r-- | epan/dissectors/packet-ipmi-trace.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/epan/dissectors/packet-ipmi-trace.c b/epan/dissectors/packet-ipmi-trace.c index 921df3b6a3..c6785fda74 100644 --- a/epan/dissectors/packet-ipmi-trace.c +++ b/epan/dissectors/packet-ipmi-trace.c @@ -300,17 +300,14 @@ dissect_ipmi_trace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da col_set_str(pinfo->cinfo, COL_INFO, "Channel State Change Notification"); } else if (block_type == HPM2_EMBED_ASCII_MSG) { - char str[257]; + gchar *str; /* get data length */ guint str_len = tvb_get_guint8(tvb, 10); if (str_len) { /* copy string */ - tvb_memcpy(tvb, str, 11, str_len); - - /* pad with nul */ - str[str_len] = 0; + str = (gchar *) tvb_get_string_enc(wmem_packet_scope(), tvb, 11, str_len, ENC_ASCII|ENC_NA); /* print the string right inside the column */ col_add_str(pinfo->cinfo, COL_INFO, str); |