aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2015-01-15 08:31:26 -0500
committerEvan Huus <eapache@gmail.com>2015-01-15 13:34:18 +0000
commitef0435bdb567e8e4cde7032617bb83aafc8bb162 (patch)
tree86c5c5de2d54337974a459609c679dc77aebc2aa
parentc2350a5070d4ceda063cf6eea3b0b869c0aebb55 (diff)
ZigBee: don't use packet_scope outside of dissection
The decode_* functions defined here are called post-dissection for formatting labels, so don't have access to packet scope. Just use and free manual memory. Introduced in gbdfabe59. Bug: 10855 Change-Id: I9b0085b1f7779ae6fbd12482c44d8f611cdbb49f Reviewed-on: https://code.wireshark.org/review/6545 Reviewed-by: Evan Huus <eapache@gmail.com>
-rw-r--r--epan/dissectors/packet-zbee-zcl-general.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c
index 087123407d..7de5be5a32 100644
--- a/epan/dissectors/packet-zbee-zcl-general.c
+++ b/epan/dissectors/packet-zbee-zcl-general.c
@@ -1766,10 +1766,14 @@ static const range_string zbee_zcl_ota_image_type_names[] = {
static void
decode_zcl_ota_curr_time(gchar *s, guint32 value)
{
- if (value == ZBEE_ZCL_OTA_TIME_NOW)
- g_snprintf(s, ITEM_LABEL_LENGTH, "Now");
- else
- g_snprintf(s, ITEM_LABEL_LENGTH, "%s", abs_time_secs_to_str(wmem_packet_scope(), value, ABSOLUTE_TIME_LOCAL, 1));
+ if (value == ZBEE_ZCL_OTA_TIME_NOW) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "Now");
+ }
+ else {
+ gchar *tmp = abs_time_secs_to_str(NULL, value, ABSOLUTE_TIME_LOCAL, 1);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%s", tmp);
+ wmem_free(NULL, tmp);
+ }
return;
} /*decode_zcl_ota_curr_time*/
@@ -1787,11 +1791,15 @@ decode_zcl_ota_curr_time(gchar *s, guint32 value)
static void
decode_zcl_ota_req_time(gchar *s, guint32 value)
{
- if (value == ZBEE_ZCL_OTA_TIME_WAIT)
- g_snprintf(s, ITEM_LABEL_LENGTH, "Wrong Value");
- else
- /* offset from now */
- g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", time_secs_to_str(wmem_packet_scope(), value));
+ if (value == ZBEE_ZCL_OTA_TIME_WAIT) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "Wrong Value");
+ }
+ else {
+ /* offset from now */
+ gchar *tmp = time_secs_to_str(NULL, value);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp);
+ wmem_free(NULL, tmp);
+ }
return;
} /*decode_zcl_ota_req_time*/
@@ -1809,11 +1817,15 @@ decode_zcl_ota_req_time(gchar *s, guint32 value)
static void
decode_zcl_ota_upgr_time(gchar *s, guint32 value)
{
- if (value == ZBEE_ZCL_OTA_TIME_WAIT)
- g_snprintf(s, ITEM_LABEL_LENGTH, "Wait for upgrade command");
- else
- /* offset from now */
- g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", time_secs_to_str(wmem_packet_scope(), value));
+ if (value == ZBEE_ZCL_OTA_TIME_WAIT) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "Wait for upgrade command");
+ }
+ else {
+ /* offset from now */
+ gchar *tmp = time_secs_to_str(NULL, value);
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%s from now", tmp);
+ wmem_free(NULL, tmp);
+ }
return;
} /*decode_zcl_ota_upgr_time*/