Bluetooth: Shell: BR: Add NULL pointer check for result->resp_buf
In case the peer device has NO SDP record, the result is valid, but the result->resp_buf is NULL, it would introduce a hardfault. Therefore, also add a NULL pointer check for result->resp_buf. Signed-off-by: Make Shi <make.shi@nxp.com>
This commit is contained in:
parent
82f7857a94
commit
345c3f17eb
1 changed files with 2 additions and 2 deletions
|
@ -380,7 +380,7 @@ static uint8_t sdp_hfp_ag_user(struct bt_conn *conn,
|
|||
|
||||
conn_addr_str(conn, addr, sizeof(addr));
|
||||
|
||||
if (result) {
|
||||
if (result && result->resp_buf) {
|
||||
shell_print(ctx_shell, "SDP HFPAG data@%p (len %u) hint %u from"
|
||||
" remote %s", result->resp_buf,
|
||||
result->resp_buf->len, result->next_record_hint,
|
||||
|
@ -440,7 +440,7 @@ static uint8_t sdp_a2src_user(struct bt_conn *conn,
|
|||
|
||||
conn_addr_str(conn, addr, sizeof(addr));
|
||||
|
||||
if (result) {
|
||||
if (result && result->resp_buf) {
|
||||
shell_print(ctx_shell, "SDP A2SRC data@%p (len %u) hint %u from"
|
||||
" remote %s", result->resp_buf,
|
||||
result->resp_buf->len, result->next_record_hint,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue