summaryrefslogtreecommitdiff
path: root/src/profile.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-11-05 15:14:50 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2015-11-08 20:07:51 +0200
commitbc4dbda3362d3654447d8ae6525cac1540b7d705 (patch)
tree6e63e303409d2cfcb7d8057635db9f863fb92207 /src/profile.c
parentf1485b759892e144f0750f1ffc120c23cd60d171 (diff)
downloadbluez-bc4dbda3362d3654447d8ae6525cac1540b7d705.tar.gz
core/profile: Fix possible crash when registering profiles
Profiles under ext_profiles are local and should no be mixed with other external profiles since its type is different which can may cause invalid memory when accessing member of ext_profile struct.
Diffstat (limited to 'src/profile.c')
-rw-r--r--src/profile.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/profile.c b/src/profile.c
index 49445d77b..5a4f09ce9 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -719,19 +719,13 @@ void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
int btd_profile_register(struct btd_profile *profile)
{
- if (profile->external)
- ext_profiles = g_slist_append(ext_profiles, profile);
- else
- profiles = g_slist_append(profiles, profile);
+ profiles = g_slist_append(profiles, profile);
return 0;
}
void btd_profile_unregister(struct btd_profile *profile)
{
- if (profile->external)
- ext_profiles = g_slist_remove(ext_profiles, profile);
- else
- profiles = g_slist_remove(profiles, profile);
+ profiles = g_slist_remove(profiles, profile);
}
static struct ext_profile *find_ext_profile(const char *owner,
@@ -742,10 +736,6 @@ static struct ext_profile *find_ext_profile(const char *owner,
for (l = ext_profiles; l != NULL; l = g_slist_next(l)) {
struct ext_profile *ext = l->data;
- /*
- * Owner and path can be NULL if profile was registered by a
- * plugin using external flag.
- */
if (g_strcmp0(ext->owner, owner))
continue;