Skip to contentSkip to conversation

mesh: Fix uninitialized JSON object pointers

PATCH New Brian Gix 1 participant 1 message Mar 9, 2019 Bluetooth drivers

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

PATCH 1/1 mesh: Fix uninitialized JSON object pointers

Fix issue that allowed only a single App Key to be added to node by remote config client.

---
 mesh/mesh-db.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
mesh/mesh-db.c +2 -4
index 2dc13cd65..f4aa6732f 100644
@@ -410,7 +410,7 @@ bool mesh_db_read_net_keys(json_object *jobj, mesh_db_net_key_cb cb,
 bool mesh_db_net_key_add(json_object *jobj, uint16_t idx,
 							const uint8_t key[16])
 {
-	json_object *jarray, *jentry = NULL, *jstring;
+	json_object *jarray = NULL, *jentry = NULL, *jstring;
 	char buf[5];
 
 	json_object_object_get_ex(jobj, "netKeys", &jarray);
@@ -529,12 +529,10 @@ bool mesh_db_write_device_key(json_object *jnode, uint8_t *key)
 bool mesh_db_app_key_add(json_object *jobj, uint16_t net_idx, uint16_t app_idx,
 							const uint8_t key[16])
 {
-	json_object *jarray, *jentry = NULL, *jstring = NULL;
+	json_object *jarray = NULL, *jentry = NULL, *jstring = NULL;
 	char buf[5];
 
 	json_object_object_get_ex(jobj, "appKeys", &jarray);
-	if (jarray)
-		return false;
 
 	if (jarray)
 		jentry = get_key_object(jarray, app_idx);
Signature · 1 line
2.14.5