aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-11-27 12:06:47 -0800
committerAnders Broman <a.broman58@gmail.com>2018-11-27 21:28:09 +0000
commitd53ff85d409367ee6538326147c8bb545bd4adb3 (patch)
treea55e3d6bdf1099c1b456ba4b2f34b34d2da3500b
parent284463cc7cd672e1844050098df2ff1682037d5f (diff)
ZigBee ZCL: Fix a divide-by-zero.
Fix a divide-by-zero in decode_color_temperature. Bug: 15281 Change-Id: I9460ffc85f6fe6b954c1810c3a80588c1aa4fec2 Reviewed-on: https://code.wireshark.org/review/30806 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-zbee-zcl-lighting.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/dissectors/packet-zbee-zcl-lighting.c b/epan/dissectors/packet-zbee-zcl-lighting.c
index 4a4fc5c069..b68a003966 100644
--- a/epan/dissectors/packet-zbee-zcl-lighting.c
+++ b/epan/dissectors/packet-zbee-zcl-lighting.c
@@ -879,7 +879,11 @@ decode_color_xy(gchar *s, guint16 value)
static void
decode_color_temperature(gchar *s, guint16 value)
{
- g_snprintf(s, ITEM_LABEL_LENGTH, "%d [Mired] (%d [K])", value, 1000000/value);
+ if (value == 0) {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%u [Mired]", value);
+ } else {
+ g_snprintf(s, ITEM_LABEL_LENGTH, "%u [Mired] (%u [K])", value, 1000000/value);
+ }
return;
} /*decode_color_temperature*/