All of lore.kernel.org
 help / color / mirror / Atom feed
* BlueZ hciconfig: Segmentation Fault
@ 2021-11-10 15:46 Jay Foster
  2021-11-11  0:29 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Foster @ 2021-11-10 15:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jay Foster

From: Jay Foster <jay.foster@systech.com>

hciconfig segfaults in the Bluez 5.62 release.

The 'hciconfig lm' command, used to show the current link mode settings,
de-references a NULL pointer when calling strcasestr().  This results in
a segmentation fault.  This is a regression in release 5.62 from the updates
to implement the appropriate language changes.

The hci_str2bit() function handles a NULL str value, but strcasestr() 
does not.

Signed-off-by: Jay Foster <jay.foster@systech.com>

--- a/lib/hci.c    2021-10-13 11:38:34.000000000 -0700
+++ b/lib/hci.c    2021-11-08 09:19:59.880207913 -0800
@@ -323,7 +323,7 @@ int hci_strtolm(char *str, unsigned int
      int ret = hci_str2bit(link_mode_map, str, val);

      /* Deprecated name. Kept for compatibility. */
-    if (strcasestr(str, "MASTER")) {
+    if (str && strcasestr(str, "MASTER")) {
          ret = 1;
          *val |= HCI_LM_MASTER;
      }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BlueZ hciconfig: Segmentation Fault
  2021-11-10 15:46 BlueZ hciconfig: Segmentation Fault Jay Foster
@ 2021-11-11  0:29 ` Luiz Augusto von Dentz
  2021-11-11 15:38   ` Jay Foster
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2021-11-11  0:29 UTC (permalink / raw)
  To: Jay Foster; +Cc: linux-bluetooth

Hi Jay,

On Wed, Nov 10, 2021 at 7:47 AM Jay Foster <jay.foster@systech.com> wrote:
>
> From: Jay Foster <jay.foster@systech.com>
>
> hciconfig segfaults in the Bluez 5.62 release.
>
> The 'hciconfig lm' command, used to show the current link mode settings,
> de-references a NULL pointer when calling strcasestr().  This results in
> a segmentation fault.  This is a regression in release 5.62 from the updates
> to implement the appropriate language changes.
>
> The hci_str2bit() function handles a NULL str value, but strcasestr()
> does not.
>
> Signed-off-by: Jay Foster <jay.foster@systech.com>
>
> --- a/lib/hci.c    2021-10-13 11:38:34.000000000 -0700
> +++ b/lib/hci.c    2021-11-08 09:19:59.880207913 -0800
> @@ -323,7 +323,7 @@ int hci_strtolm(char *str, unsigned int
>       int ret = hci_str2bit(link_mode_map, str, val);
>
>       /* Deprecated name. Kept for compatibility. */
> -    if (strcasestr(str, "MASTER")) {
> +    if (str && strcasestr(str, "MASTER")) {
>           ret = 1;
>           *val |= HCI_LM_MASTER;
>       }

You will probably need to rebase:

Applying: BlueZ hciconfig: Segmentation Fault
error: lib/hci.c    2021-11-08 09:19:59.880207913 -0800: does not exist in index
Patch failed at 0001 BlueZ hciconfig: Segmentation Fault


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BlueZ hciconfig: Segmentation Fault
  2021-11-11  0:29 ` Luiz Augusto von Dentz
@ 2021-11-11 15:38   ` Jay Foster
  0 siblings, 0 replies; 3+ messages in thread
From: Jay Foster @ 2021-11-11 15:38 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

On 11/10/2021 4:29 PM, Luiz Augusto von Dentz wrote:
> Hi Jay,
>
> On Wed, Nov 10, 2021 at 7:47 AM Jay Foster <jay.foster@systech.com> wrote:
>> From: Jay Foster <jay.foster@systech.com>
>>
>> hciconfig segfaults in the Bluez 5.62 release.
>>
>> The 'hciconfig lm' command, used to show the current link mode settings,
>> de-references a NULL pointer when calling strcasestr().  This results in
>> a segmentation fault.  This is a regression in release 5.62 from the updates
>> to implement the appropriate language changes.
>>
>> The hci_str2bit() function handles a NULL str value, but strcasestr()
>> does not.
>>
>> Signed-off-by: Jay Foster <jay.foster@systech.com>
>>
>> --- a/lib/hci.c    2021-10-13 11:38:34.000000000 -0700
>> +++ b/lib/hci.c    2021-11-08 09:19:59.880207913 -0800
>> @@ -323,7 +323,7 @@ int hci_strtolm(char *str, unsigned int
>>        int ret = hci_str2bit(link_mode_map, str, val);
>>
>>        /* Deprecated name. Kept for compatibility. */
>> -    if (strcasestr(str, "MASTER")) {
>> +    if (str && strcasestr(str, "MASTER")) {
>>            ret = 1;
>>            *val |= HCI_LM_MASTER;
>>        }
> You will probably need to rebase:
>
> Applying: BlueZ hciconfig: Segmentation Fault
> error: lib/hci.c    2021-11-08 09:19:59.880207913 -0800: does not exist in index
> Patch failed at 0001 BlueZ hciconfig: Segmentation Fault
>
>
Regenerated patch using git.
From: Jay Foster <jay.foster@systech.com>

hciconfig segfaults in the Bluez 5.62 release.

The 'hciconfig lm' command, used to show the current link mode settings,
de-references a NULL pointer when calling strcasestr().  This results in
a segmentation fault.  This is a regression in release 5.62 from the updates
to implement the appropriate language changes.

The hci_str2bit() function handles a NULL str value, but strcasestr()
does not.

Signed-off-by: Jay Foster <jay.foster@systech.com>

diff --git a/lib/hci.c b/lib/hci.c
index 5141f20..0436759 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -323,7 +323,7 @@ int hci_strtolm(char *str, unsigned int *val)
      int ret = hci_str2bit(link_mode_map, str, val);

      /* Deprecated name. Kept for compatibility. */
-    if (strcasestr(str, "MASTER")) {
+    if (str && strcasestr(str, "MASTER")) {
          ret = 1;
          *val |= HCI_LM_MASTER;
      }


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-11 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 15:46 BlueZ hciconfig: Segmentation Fault Jay Foster
2021-11-11  0:29 ` Luiz Augusto von Dentz
2021-11-11 15:38   ` Jay Foster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.