* [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
@ 2009-02-25 11:56 evermind
2009-02-25 14:13 ` Marcel Holtmann
0 siblings, 1 reply; 7+ messages in thread
From: evermind @ 2009-02-25 11:56 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Frieder Buerzele
From: Frieder Buerzele <evermind@tuxfamily.org>
---
gdbus/object.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 0786aeb..d920eac 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -224,11 +224,12 @@ static struct interface_data *find_interface(GSList *interfaces,
{
GSList *list;
- for (list = interfaces; list; list = list->next) {
- struct interface_data *iface = list->data;
- if (!strcmp(name, iface->name))
- return iface;
- }
+ if (name)
+ for (list = interfaces; list; list = list->next) {
+ struct interface_data *iface = list->data;
+ if (!strcmp(name, iface->name))
+ return iface;
+ }
return NULL;
}
--
1.5.6.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
2009-02-25 11:56 evermind
@ 2009-02-25 14:13 ` Marcel Holtmann
0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2009-02-25 14:13 UTC (permalink / raw)
To: evermind; +Cc: linux-bluetooth
Hi Frieder,
> ---
> gdbus/object.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/gdbus/object.c b/gdbus/object.c
> index 0786aeb..d920eac 100644
> --- a/gdbus/object.c
> +++ b/gdbus/object.c
> @@ -224,11 +224,12 @@ static struct interface_data *find_interface(GSList *interfaces,
> {
> GSList *list;
>
> - for (list = interfaces; list; list = list->next) {
> - struct interface_data *iface = list->data;
> - if (!strcmp(name, iface->name))
> - return iface;
> - }
> + if (name)
> + for (list = interfaces; list; list = list->next) {
> + struct interface_data *iface = list->data;
> + if (!strcmp(name, iface->name))
> + return iface;
> + }
>
> return NULL;
> }
what about something like this:
if (name == NULL)
return NULL;
Regards
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
@ 2009-02-26 8:35 Frieder Buerzele
2009-02-26 8:35 ` Frieder Buerzele
0 siblings, 1 reply; 7+ messages in thread
From: Frieder Buerzele @ 2009-02-26 8:35 UTC (permalink / raw)
To: linux-bluetooth
Hi Frieder,
> > ---
> > gdbus/object.c | 11 ++++++-----
> > 1 files changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/gdbus/object.c b/gdbus/object.c
> > index 0786aeb..d920eac 100644
> > --- a/gdbus/object.c
> > +++ b/gdbus/object.c
> > @@ -224,11 +224,12 @@ static struct interface_data
> > *find_interface(GSList *interfaces,
> > {
> > GSList *list;
> >
> > - for (list = interfaces; list; list = list->next) {
> > - struct interface_data *iface = list->data;
> > - if (!strcmp(name, iface->name))
> > - return iface;
> > - }
> > + if (name)
> > + for (list = interfaces; list; list = list->next) {
> > + struct interface_data *iface = list->data;
> > + if (!strcmp(name, iface->name))
> > + return iface;
> > + }
> >
> > return NULL;
> > }
>
> what about something like this:
>
> if (name == NULL)
> return NULL;
>
> Regards
>
> Marcel
>
k, I'll resend a updated patch
Greetz Frieder
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
2009-02-26 8:35 Frieder Buerzele
@ 2009-02-26 8:35 ` Frieder Buerzele
0 siblings, 0 replies; 7+ messages in thread
From: Frieder Buerzele @ 2009-02-26 8:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Frieder Buerzele
---
gdbus/object.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 0786aeb..7bc9860 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -222,6 +222,9 @@ static void generic_unregister(DBusConnection *connection, void *user_data)
static struct interface_data *find_interface(GSList *interfaces,
const char *name)
{
+ if (NULL == name)
+ return NULL;
+
GSList *list;
for (list = interfaces; list; list = list->next) {
--
1.5.6.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
@ 2009-02-26 8:46 Frieder Buerzele
2009-02-26 8:46 ` Frieder Buerzele
0 siblings, 1 reply; 7+ messages in thread
From: Frieder Buerzele @ 2009-02-26 8:46 UTC (permalink / raw)
To: linux-bluetooth
> > Hi Frieder,
> >
> > > ---
> > > gdbus/object.c | 11 ++++++-----
> > > 1 files changed, 6 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/gdbus/object.c b/gdbus/object.c
> > > index 0786aeb..d920eac 100644
> > > --- a/gdbus/object.c
> > > +++ b/gdbus/object.c
> > > @@ -224,11 +224,12 @@ static struct interface_data
> > > *find_interface(GSList *interfaces,
> > > {
> > > GSList *list;
> > >
> > > - for (list = interfaces; list; list = list->next) {
> > > - struct interface_data *iface = list->data;
> > > - if (!strcmp(name, iface->name))
> > > - return iface;
> > > - }
> > > + if (name)
> > > + for (list = interfaces; list; list = list->next) {
> > > + struct interface_data *iface = list->data;
> > > + if (!strcmp(name, iface->name))
> > > + return iface;
> > > + }
> > >
> > > return NULL;
> > > }
> >
> > what about something like this:
> >
> > if (name == NULL)
> > return NULL;
> >
> > Regards
> >
> > Marcel
> >
>
> k, I'll resend a updated patch
>
> Greetz Frieder
just forget to test compile the patch, here is the "fixed" fix patch
Greetz Frieder
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
2009-02-26 8:46 [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash Frieder Buerzele
@ 2009-02-26 8:46 ` Frieder Buerzele
2009-02-28 21:46 ` Marcel Holtmann
0 siblings, 1 reply; 7+ messages in thread
From: Frieder Buerzele @ 2009-02-26 8:46 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Frieder Buerzele
---
gdbus/object.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 0786aeb..dde654b 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -224,6 +224,9 @@ static struct interface_data *find_interface(GSList *interfaces,
{
GSList *list;
+ if (NULL == name)
+ return NULL;
+
for (list = interfaces; list; list = list->next) {
struct interface_data *iface = list->data;
if (!strcmp(name, iface->name))
--
1.5.6.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash
2009-02-26 8:46 ` Frieder Buerzele
@ 2009-02-28 21:46 ` Marcel Holtmann
0 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2009-02-28 21:46 UTC (permalink / raw)
To: Frieder Buerzele; +Cc: linux-bluetooth
Hi Frieder,
> diff --git a/gdbus/object.c b/gdbus/object.c
> index 0786aeb..dde654b 100644
> --- a/gdbus/object.c
> +++ b/gdbus/object.c
> @@ -224,6 +224,9 @@ static struct interface_data *find_interface(GSList *interfaces,
> {
> GSList *list;
>
> + if (NULL == name)
> + return NULL;
> +
> for (list = interfaces; list; list = list->next) {
> struct interface_data *iface = list->data;
> if (!strcmp(name, iface->name))
a similar patch has been applied to bluez, obexd and connmand. Thanks.
Regards
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-02-28 21:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-26 8:46 [PATCH] Fix segfault: If the interface name is NULL the bluetoothd daemon will crash Frieder Buerzele
2009-02-26 8:46 ` Frieder Buerzele
2009-02-28 21:46 ` Marcel Holtmann
-- strict thread matches above, loose matches on Subject: below --
2009-02-26 8:35 Frieder Buerzele
2009-02-26 8:35 ` Frieder Buerzele
2009-02-25 11:56 evermind
2009-02-25 14:13 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox