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

Array access fix #5

Merged
merged 2 commits into from
Apr 24, 2024
Merged

Array access fix #5

merged 2 commits into from
Apr 24, 2024

Conversation

tobiasfrejo
Copy link
Member

Fixes problem with failed to fetch error when accessing arrays with an index with multiple digits.

Cause:
When reading the index of an array param, strtok_r is used to tokenize the string around the '[' character.
strtok_r then replaces the '[' with a '\0'. As this is done directly on the function input, this introduces an unexpected side-effect.
This is solved by copying the input and searching on the copy.

The problem does not occur on single digit due to the second bug where the index is supposed to be removed. Here we need to remove the number of digits and both the starting and ending bracket, thus (index_length+2)

@tobiasfrejo tobiasfrejo requested a review from NValsted April 23, 2024 19:13
@NValsted NValsted merged commit 776767b into discosat:main Apr 24, 2024
1 check passed
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