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

test/boot_switch: fix out of bound read #1415

Merged
merged 1 commit into from
May 13, 2024

Conversation

jluebbe
Copy link
Member

@jluebbe jluebbe commented May 13, 2024

g_bytes_unref_to_data doesn't provide a null-terminated string, so json_from_string might read beyond the end of the subprocess output. Instead of adding a null-byte ourselves, switch to g_subprocess_communicate_utf8.

This is a better fit, as json_from_string expects a valid UTF-8 string anyway.

Fixes: #1414

g_bytes_unref_to_data doesn't provide a null-terminated string, so
json_from_string might read beyond the end of the subprocess output.
Instead of adding a null-byte ourselves, switch to
g_subprocess_communicate_utf8.

This is a better fit, as json_from_string expects a valid UTF-8 string
anyway.

Fixes: rauc#1414
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
@LeBlue
Copy link

LeBlue commented May 13, 2024

@jluebbe @ejoerns The proposed change fixes the test on my setup.

@jluebbe jluebbe added this to the Release v1.12 milestone May 13, 2024
@ejoerns ejoerns merged commit d2ebead into rauc:master May 13, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: boot_switch: possible out of bound read and test fail
3 participants