diff options
author | Yun-Hao Chung <howardchung@chromium.org> | 2022-02-14 17:13:43 +0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-02-15 13:31:42 -0800 |
commit | b5ff08b267445f9407d6eefad86cde45ec3a50a2 (patch) | |
tree | b23c6517ad49fb2208d6f38329212b0e1df666a8 /lib | |
parent | 6c9c4b7c3ab5f798b058bbb9e5abcdbe27b75b15 (diff) | |
download | bluez-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |