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

Fix #881, check overlap before calling strcpy in cJSON_SetValuestring #885

Merged
merged 4 commits into from
Aug 30, 2024

Conversation

vwvw
Copy link
Contributor

@vwvw vwvw commented Aug 23, 2024

Add a check to be sure that the string don't overlap to avoid issues with strcpy.
Fixes #881

All the credit goes to @tregua87

@PeterAlfredLee
Copy link
Contributor

LGTM
It will be appreciated if you can also add some tests.

@vwvw
Copy link
Contributor Author

vwvw commented Aug 25, 2024

Added a test, let me know how it looks.

@Alanscut
Copy link
Collaborator

Valgrind reports.
Looks you forgot about the memory free in tests.

@vwvw
Copy link
Contributor Author

vwvw commented Aug 27, 2024

Pushed the necessary fix to make valgrind happy again!

@Alanscut Alanscut merged commit 078c4e6 into DaveGamble:master Aug 30, 2024
13 checks 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.

no overlap control in cJSON_SetValuestring
3 participants