Re: BlueZ hciconfig: Segmentation Fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx> wrote:
From: Jay Foster <jay.foster@xxxxxxxxxxx>

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@xxxxxxxxxxx>

--- 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@xxxxxxxxxxx>

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@xxxxxxxxxxx>

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;
     }




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux