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

nimble/host: Fix not catching conversion error in hex2bin #1625

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

sjanc
Copy link
Contributor

@sjanc sjanc commented Sep 26, 2023

hex2val returns BLE_HS_EINVAL on error which is positive value. This could result in UUID conversion errors as hex2bin is used by ble_uuid_from_str.

This was also causing build error with GCC 9:

repos/apache-mynewt-nimble/nimble/host/src/ble_uuid.c:76:28: error:
'tmp_val' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
76 | bin[len] = tmp_val << 4;
| ~~~~~~~~^~~~
cc1: all warnings being treated as errors

hex2val returns BLE_HS_EINVAL on error which is positive value.
This could result in UUID conversion errors as hex2bin is used
by ble_uuid_from_str.

This was also causing build error with GCC 9:

repos/apache-mynewt-nimble/nimble/host/src/ble_uuid.c:76:28: error:
     'tmp_val' may be used uninitialized in this function
     [-Werror=maybe-uninitialized]
   76 |         bin[len] = tmp_val << 4;
      |                    ~~~~~~~~^~~~
cc1: all warnings being treated as errors
@sjanc
Copy link
Contributor Author

sjanc commented Sep 26, 2023

@jrotkiewicz FYI

@sjanc
Copy link
Contributor Author

sjanc commented Sep 26, 2023

fixes build issue from apache/mynewt-core#3015

@sjanc sjanc merged commit 20241c2 into apache:master Oct 4, 2023
8 checks passed
@sjanc sjanc deleted the uuid_str branch October 4, 2023 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants