diff mbox series

[1/1] mesh: Check limits for count and interval of relay

Message ID 1585078044-14974-2-git-send-email-prathyusha.n@samsung.com
State New
Headers show
Series [1/1] mesh: Check limits for count and interval of relay | expand

Commit Message

Prathyusha Nelluri March 24, 2020, 7:27 p.m. UTC
From: Prathyusha N <prathyusha.n@samsung.com>

Added limit checking condition for count and interval
before processing for count and interval steps.
---
 mesh/cfgmod-server.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index 7111411c7..151cab154 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -881,7 +881,11 @@  static bool cfg_srv_pkt(uint16_t src, uint32_t dst, uint16_t unicast,
 		n = mesh_model_opcode_set(OP_CONFIG_RELAY_STATUS, msg);
 
 		msg[n++] = node_relay_mode_get(node, &count, &interval);
-		msg[n++] = (count - 1) + ((interval/10 - 1) << 3);
+
+		if (count > 0 && interval >= 10)
+			msg[n++] = (count - 1) + ((interval/10 - 1) << 3);
+		else
+			msg[n++] = 0;
 
 		l_debug("Get/Set Relay Config (%d)", msg[n-1]);
 		break;