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

Rewrite str_replace using snprintf for security and fix clang-tidy #2350

Merged
merged 1 commit into from
May 8, 2024

Conversation

jiegec
Copy link
Contributor

@jiegec jiegec commented May 3, 2024

Your checklist for this pull request

  • I've documented or updated the documentation of every API function and struct this PR changes.
  • I've added tests that prove my fix is effective or that my feature works (if possible)

Detailed description

Avoid potential integer underflow in strlen(target) - strlen(str1) + strlen(str2) if strlen(str1) is very large. Use snprintf to ensure memory safety.

Test plan

...

Closing issues

...

@github-actions github-actions bot added the CS-core-files auto-sync label May 3, 2024
@Rot127
Copy link
Collaborator

Rot127 commented May 4, 2024

Almost forgot. Please change the doxygen comment of the function to use /// instead of //

@jiegec
Copy link
Contributor Author

jiegec commented May 4, 2024

Almost forgot. Please change the doxygen comment of the function to use /// instead of //

Done

@XVilka
Copy link
Contributor

XVilka commented May 5, 2024

@kabeor, could you take a quick look at this one? To unblock further LoongArch work?

Copy link
Member

@kabeor kabeor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks!

@kabeor kabeor merged commit 9378216 into capstone-engine:next May 8, 2024
14 checks passed
@jiegec jiegec deleted the fix-clang-tidy branch May 8, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CS-core-files auto-sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants