Skip to content

CDRIVER-5743 Followup fix for signedness warning #1907

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

Merged
1 commit merged into from
Mar 11, 2025

Conversation

ghost
Copy link

@ghost ghost commented Mar 10, 2025

Fixes a signed comparison added in #1903. (winssl only)

@ghost ghost requested a review from vector-of-bool March 10, 2025 18:18
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

Thank you for the fix.

@ghost ghost merged commit be04a7e into mongodb:master Mar 11, 2025
40 of 42 checks passed
@ghost ghost removed the request for review from vector-of-bool March 11, 2025 18:24
kevinAlbs pushed a commit to kevinAlbs/mongo-c-driver that referenced this pull request May 16, 2025
kevinAlbs added a commit that referenced this pull request May 19, 2025
#2015)

* CDRIVER-5743: NUL terminate string, handle more error cases (#1903)

* NUL termination and error handling fixes for mongoc_secure_channel_setup_ca

* CDRIVER-5743 Followup fix for signedness warning (#1907)

* CDRIVER-3228 fix memory leaks in SChannel cert loading (#2009)

* Store and free client cert context
* Free on successful load of client cert
** Do not return before `fail` label.
* Free `hKey`
* Free pem file and cert when loading CA file
* Release provider context on error
* NUL terminate pem file contents
** To ensure `strstr` does not read past memory on failure to find.
* Remove unused printf
* Add `read_file_and_null_terminate` helper
* Rename `encrypted_*` to `encoded_*`
** Encrypted keys are not supported with SChannel.
** "encoded" is consistent with naming in WinCrypt API.
* check if `pem_public` is NULL
** Avoids NULL deref if PEM file does not have public cert
* Remove call to `CryptQueryObject` for public cert
** The flag `CERT_QUERY_CONTENT_FLAG_ALL`  is likely incorrect (only certificate is expected)
* Remove call to `CryptQueryObject` for CRL
** Return was wrongly stored in a `CERT_CONTEXT` (needed `CRL_CONTEXT`).
** Use `CertCreateCRLContext` for consistency with other PEM-reading functions.
* Remove unused params

---------

Co-authored-by: mdbmes <[email protected]>
Co-authored-by: Ezra Chung <[email protected]>
This pull request was closed.
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.

1 participant