From d53ff85d409367ee6538326147c8bb545bd4adb3 Mon Sep 17 00:00:00 2001
From: Gerald Combs <gerald@wireshark.org>
Date: Tue, 27 Nov 2018 12:06:47 -0800
Subject: [PATCH] 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>
---
 epan/dissectors/packet-zbee-zcl-lighting.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/epan/dissectors/packet-zbee-zcl-lighting.c b/epan/dissectors/packet-zbee-zcl-lighting.c
index 4a4fc5c..b68a003 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_power_conf_voltage*/
 
-- 
1.7.12.4

