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 Seg-fault when setting proxy username + password #1181

Merged
merged 6 commits into from
Feb 17, 2025

Conversation

simue
Copy link
Contributor

@simue simue commented Feb 14, 2025

Providing a char* to underlying data of string_view instead string_view itself to curl api.
Fixes #1180

@simue simue marked this pull request as ready for review February 16, 2025 11:29
@simue simue changed the title test for seg-fault Fix Seg-fault when setting proxy username + password Feb 16, 2025
@COM8 COM8 added the Bug 🐛 label Feb 16, 2025
@COM8 COM8 added this to the CPR 1.11.x milestone Feb 16, 2025
Copy link
Member

@COM8 COM8 left a comment

Choose a reason for hiding this comment

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

@simue thank you very much for fixing this!
Please also apply the change for those lines here:
https://github.com/libcpr/cpr/blob/master/cpr/session.cpp#L665

I also noticed that this is copy/paste code here so it could be singled out into its own function.

@COM8
Copy link
Member

COM8 commented Feb 16, 2025

Also the clang tidy warning can be ignored in this case although a better way would be to replace returning a std::string_view with const std::string& in my eyes.

@simue
Copy link
Contributor Author

simue commented Feb 16, 2025

I went for returning a const ref to the SecureString, so we don´t do a copy to std::string, leading to the credentials potentially staying in memory

@simue simue requested a review from COM8 February 17, 2025 12:43
Copy link
Member

@COM8 COM8 left a comment

Choose a reason for hiding this comment

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

Well done. Thanks for interoperating those changes.

@COM8 COM8 merged commit c121ee0 into libcpr:master Feb 17, 2025
44 checks passed
COM8 added a commit that referenced this pull request Feb 17, 2025
Fix Seg-fault when setting proxy username + password
@simue simue deleted the fix/proxy-authentication-segfault branch February 20, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segfault in Session::prepareCommonShared with proxy authentication
2 participants