From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> set_name might be invoked with name argument as shown below: set_name(adapter, btd_adapter_get_name(adapter)) and btd_adapter_get_name may return NULL. Add check to prevent crash. --- src/adapter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 17f5508..7291a6d 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -643,6 +643,9 @@ static int set_name(struct btd_adapter *adapter, const char *name) struct mgmt_cp_set_local_name cp; char maxname[MAX_NAME_LENGTH + 1]; + if (name == NULL) + return -EINVAL; + memset(maxname, 0, sizeof(maxname)); strncpy(maxname, name, MAX_NAME_LENGTH); -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html