summaryrefslogtreecommitdiff
path: root/mesh/appkey.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-02-13 19:45:27 -0800
committerBrian Gix <brian.gix@intel.com>2019-02-19 08:54:07 -0800
commit4a219255437b1b5a63ea3e472281379ede6d793a (patch)
tree5d492a84bb21a40c3478a3f8f63f85d81c87b6c7 /mesh/appkey.c
parent126f01f83ab2f1f81080685eeef75102f5cc8b54 (diff)
downloadbluez-4a219255437b1b5a63ea3e472281379ede6d793a.tar.gz
mesh: Return correct error code for AppKey List command
If AppKey List command is called with a network key index that is not valid for the node, return Invalid NetKey Index error code
Diffstat (limited to 'mesh/appkey.c')
-rw-r--r--mesh/appkey.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mesh/appkey.c b/mesh/appkey.c
index f799b7782..3cc1e4f0b 100644
--- a/mesh/appkey.c
+++ b/mesh/appkey.c
@@ -506,6 +506,9 @@ uint8_t appkey_list(struct mesh_net *net, uint16_t net_idx, uint8_t *buf,
*size = 0;
+ if (!mesh_net_have_key(net, net_idx))
+ return MESH_STATUS_INVALID_NETKEY;
+
app_keys = mesh_net_get_app_keys(net);
if (!app_keys || l_queue_isempty(app_keys))
return MESH_STATUS_SUCCESS;