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

Rectify parameters passed to strsep to avoid error EINVAL #6

Merged
merged 1 commit into from
Aug 24, 2022

Conversation

nil4git
Copy link
Contributor

@nil4git nil4git commented Mar 3, 2022

Function strcspn & strsep expects a null terminated string delimiter in this case so as to avoid corruption
This issue is observed with example incoming string B0L0000000C passed to rpmsg_sdb_decode_rxbuf_string
With delimiter set to {'L'} and not null terminated, whereas the function strcspn expects a null terminated string
This will result in delimiter with garbage value getting passed eventually resulting in EINVAL issue observed specifically in case of B0 as observed below
incoming string [B0L0000000C] rxbuf_str string [L0000000C] and subString is [B]

Function strcspn & strsep expects a null terminated string delimiter in this case so as to avoid corruption
This issue is observed with example incoming string B0L0000000C passed to rpmsg_sdb_decode_rxbuf_string
With delimiter set to {'L'} and not null terminated, whereas the function strcspn expects a null terminated string
This will result in delimiter with garbage value getting passed eventually resulting in EINVAL issue observed specifically in case of B0 as observed below
incoming string [B0L0000000C] rxbuf_str string [L0000000C] and subString is [B]
@nil4git
Copy link
Contributor Author

nil4git commented Mar 3, 2022

@jctrotin @mcatrouillet @mcatrouST @timblechmann Kindly review
Thanks

This should close the open issue #2 as well

@jctrotin jctrotin merged commit 17c7cc2 into STMicroelectronics:dunfell Aug 24, 2022
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