mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
net/bluetooth: fix null pointer dereference in bluetooth_sendmsg
Move the NULL check for radio pointer before the DEBUGASSERT that dereferences it. Previously DEBUGASSERT(radio->r_dev.d_lltype == ...) was executed before verifying radio != NULL, which would crash when the device is not found. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
4257c55eeb
commit
a0b8969636
1 changed files with 2 additions and 2 deletions
|
|
@ -284,12 +284,12 @@ static ssize_t bluetooth_sendto(FAR struct socket *psock,
|
|||
radio =
|
||||
(FAR struct radio_driver_s *)netdev_findbyindex(conn->bc_ldev + 1);
|
||||
|
||||
DEBUGASSERT(radio->r_dev.d_lltype == NET_LL_BLUETOOTH);
|
||||
|
||||
if (radio == NULL)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
DEBUGASSERT(radio->r_dev.d_lltype == NET_LL_BLUETOOTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue