summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYun-Hao Chung <howardchung@chromium.org>2022-02-14 17:13:43 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-02-15 13:31:42 -0800
commitb5ff08b267445f9407d6eefad86cde45ec3a50a2 (patch)
treeb23c6517ad49fb2208d6f38329212b0e1df666a8 /lib
parent6c9c4b7c3ab5f798b058bbb9e5abcdbe27b75b15 (diff)
downloadbluez-b5ff08b267445f9407d6eefad86cde45ec3a50a2.tar.gz
lib: fix hci_strtolm crash
|str| can be NULL in the case of reading lm value. Calling strcasestr could lead to a crash. Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/hci.c2
1 files changed, 1 insertions, 1 deletions
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;
}