2022-02-14 09:49:46

by Yun-hao Chung

[permalink] [raw]
Subject: [Bluez PATCH v1] lib: fix hci_strtolm crash

From: Yun-Hao Chung <[email protected]>

|str| can be NULL in the case of reading lm value. Calling strcasestr
could lead to a crash.

Reviewed-by: Archie Pusaka <[email protected]>
---
Verified by running "hciconfig hci0 lm" on hatch

lib/hci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/hci.c b/lib/hci.c
index 5141f20ac..5228c2ad2 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;
}
--
2.35.1.265.g69c8d7142f-goog


2022-02-14 20:10:10

by bluez.test.bot

[permalink] [raw]
Subject: RE: [Bluez,v1] lib: fix hci_strtolm crash

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=614021

---Test result---

Test Summary:
CheckPatch PASS 1.45 seconds
GitLint PASS 0.99 seconds
Prep - Setup ELL PASS 48.69 seconds
Build - Prep PASS 0.86 seconds
Build - Configure PASS 10.41 seconds
Build - Make PASS 1734.15 seconds
Make Check PASS 12.61 seconds
Make Check w/Valgrind PASS 513.86 seconds
Make Distcheck PASS 274.19 seconds
Build w/ext ELL - Configure PASS 10.20 seconds
Build w/ext ELL - Make PASS 1758.78 seconds
Incremental Build with patchesPASS 0.00 seconds



---
Regards,
Linux Bluetooth