Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: TBS: Fix NULL pointer issue in v3.7 #84149

Open
wants to merge 2 commits into
base: v3.7-branch
Choose a base branch
from

Conversation

Thalley
Copy link
Collaborator

@Thalley Thalley commented Jan 17, 2025

Fixes #84148

If we read an empty GATT characteristic that should contain a
string value, then we provide the empty string, instead of NULL,
to be true to the API.

Signed-off-by: Emil Gydesen <[email protected]>
The supported URI list may be empty which the sample did not
properly support.

Signed-off-by: Emil Gydesen <[email protected]>
@@ -139,6 +140,11 @@ int ccp_originate_call(void)
int err;
char uri[CONFIG_BT_TBS_MAX_URI_LENGTH];

if (strlen(remote_uri) == 0U) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite minor, but when you just want to know if the string is empty or not, strlen() is rather overkill since you end up iterating the entire string every time when you're actually only interested in the first byte. if (str[0] == '\0') is not the prettiest thing either, so it could be nice to have a helper for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

4 participants