appkey_key_add() checks if the number of known appkeys is smaller or equal than MAX_APP_KEYS, but it should check if it is equal or larger than MAX_APP_KEYS. --- mesh/appkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh/appkey.c b/mesh/appkey.c index 2ddb1eb..7578118 100644 --- a/mesh/appkey.c +++ b/mesh/appkey.c @@ -398,7 +398,7 @@ int appkey_key_add(struct mesh_net *net, uint16_t net_idx, uint16_t app_idx, } if (!key) { - if (l_queue_length(app_keys) <= MAX_APP_KEYS) + if (l_queue_length(app_keys) >= MAX_APP_KEYS) return MESH_STATUS_INSUFF_RESOURCES; key = app_key_new();