diff options
author | Inga Stotland <inga.stotland@intel.com> | 2019-03-01 15:53:15 -0800 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2019-03-07 12:58:09 -0800 |
commit | 2ada1c13f687dad28492958af6cc0a6ecb392e2b (patch) | |
tree | f1f19fd7175798a2ee703096c9f6bf6725d64298 /mesh/mesh.c | |
parent | b01440aba1918192fc5fa8f179ab665e6c9ca239 (diff) | |
download | bluez-2ada1c13f687dad28492958af6cc0a6ecb392e2b.tar.gz |
mesh: Fix array processing in Send, Publish, Join
Use correct parameters when calling l_dbus_message_iter_get_fixed_array().
Also, check the return value and the length of the processed array and
return an error if the checks fail.
Diffstat (limited to 'mesh/mesh.c')
-rw-r--r-- | mesh/mesh.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/mesh/mesh.c b/mesh/mesh.c index 8db83b7c3..a0a9a7c8e 100644 --- a/mesh/mesh.c +++ b/mesh/mesh.c @@ -73,7 +73,7 @@ struct join_data{ const char *app_path; struct mesh_node *node; uint32_t disc_watch; - uint8_t uuid[16]; + uint8_t *uuid; }; struct attach_data { @@ -561,7 +561,6 @@ static struct l_dbus_message *join_network_call(struct l_dbus *dbus, { const char *app_path, *sender; struct l_dbus_message_iter iter_uuid; - uint8_t *uuid; uint32_t n; l_debug("Join network request"); @@ -576,17 +575,15 @@ static struct l_dbus_message *join_network_call(struct l_dbus *dbus, join_pending = l_new(struct join_data, 1); - l_dbus_message_iter_get_fixed_array(&iter_uuid, &uuid, &n); - - if (n != 16) { + if (!l_dbus_message_iter_get_fixed_array(&iter_uuid, + &join_pending->uuid, &n) + || n != 16) { l_free(join_pending); join_pending = NULL; return dbus_error(msg, MESH_ERROR_INVALID_ARGS, "Bad device UUID"); } - memcpy(join_pending->uuid, uuid, 16); - sender = l_dbus_message_get_sender(msg); join_pending->sender = l_strdup(sender); |