[CDRIVER-4166] Permit NULL as valid platform for mongoc_handshake_data_append Created: 20/Sep/21  Updated: 28/Oct/23  Resolved: 29/Sep/21

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.19.1

Type: Bug Priority: Critical - P2
Reporter: Kevin Albertson Assignee: Ezra Chung
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Background & Motivation

The C++ driver assumes it is OK to pass NULL as the platform string in mongoc_handshake_append_data: https://github.com/mongodb/mongo-cxx-driver/blob/fd84da871c35cbc4beee0b39afa188b84c698fc1/src/mongocxx/instance.cpp#L93. That agrees with the documentation of mongoc_handshake_data_append. It notes all three arguments are optional.

However, libmongoc currently does not check for NULL in this case: https://github.com/mongodb/mongo-c-driver/blob/25496ec9c57fcd538103bb13ae7b98ec464cfb53/src/libmongoc/src/mongoc/mongoc-handshake.c#L636-L641

Scope

  • Accept a NULL platform argument in mongoc_handshake_data_append. Handle it equivalently to an empty string.


 Comments   
Comment by Githook User [ 05/Oct/21 ]

Author:

{'name': 'Ezra Chung', 'email': '88335979+eramongodb@users.noreply.github.com', 'username': 'eramongodb'}

Message: CDRIVER-4166 permit NULL platform argument to mongoc_handshake_data_append() (#877)
Branch: r1.19
https://github.com/mongodb/mongo-c-driver/commit/00c56e79d2bc05c1defb750f932c8eea81419cca

Comment by Githook User [ 29/Sep/21 ]

Author:

{'name': 'Ezra Chung', 'email': '88335979+eramongodb@users.noreply.github.com', 'username': 'eramongodb'}

Message: CDRIVER-4166 permit NULL platform argument to mongoc_handshake_data_append() (#877)
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/42470e265d12a15cb2ddcdfc85db55a418c39f0f

Generated at Wed Feb 07 21:20:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.