GODRIVER-3770 Fix buffer handling in GSSAPI error description and username functions#2291
Merged
prestonvasquez merged 2 commits intomongodb:release/1.17from Jan 20, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes buffer handling bugs in GSSAPI authentication code where memcpy was copying one byte beyond the allocated buffer. The changes ensure proper buffer copying and explicit null-termination of strings.
Changes:
- Fixed buffer overflow in
gssapi_error_descby copying only the actual buffer length and adding explicit null-termination - Fixed identical buffer overflow in
gssapi_client_usernamewith the same approach - Added AddressSanitizer flags to the enterprise auth test to detect memory errors in GSSAPI C code
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| x/mongo/driver/auth/internal/gssapi/gss_wrapper.c | Fixed buffer overflow bugs in error description and username functions by correcting memcpy length and adding explicit null-termination |
| README.md | Added deprecation notice for this version of the Go driver |
| Makefile | Added AddressSanitizer flags to enterprise auth test for memory error detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RafaelCenzano
previously approved these changes
Jan 20, 2026
Contributor
API Change ReportNo changes found! |
qingyang-hu
reviewed
Jan 20, 2026
Contributor
There was a problem hiding this comment.
[Optional] I wonder if calloc is preferable to malloc since 0 padding is not necessary anymore.
RafaelCenzano
approved these changes
Jan 20, 2026
prestonvasquez
added a commit
to prestonvasquez/mongo-go-driver
that referenced
this pull request
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix buffer handling in
gssapi_error_descandgssapi_client_usernameto correctly copy buffer contents and null-terminate strings.Verified with AddressSanitizer that buffer operations are correct.