Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libmongoc/src/mongoc/mongoc-cyrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ _mongoc_cyrus_canon_user(sasl_conn_t *conn,

// `inlen` is a string length (excluding trailing NULL).
// Cyrus-SASL passes an `out` buffer of size `out_max + 1`. Assume `out_max` is the max to be safe.
if (inlen + 1 >= out_max) {
if (inlen == UINT_MAX || inlen + 1 >= out_max) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I recommend using mlib_add() here, since it is not sensitive to the types of its argument, while this relies on UINT_MAX always being the correct value to check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Updated to use mlib_add().

MONGOC_ERROR("SASL username too large");
return SASL_BUFOVER;
}
Expand Down