[CDRIVER-409] Error condition is not handled correctly for NULL value Created: 19/Aug/14  Updated: 19/Aug/14  Resolved: 19/Aug/14

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

Type: Bug Priority: Major - P3
Reporter: Anil Kumar Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 Description   

if (!node.replSet || !!strcmp (node.replSet, replSet)) {
   MONGOC_INFO("%s: Got replicaSet \"%s\" expected \"%s\".",
               iter->host_and_port, node.replSet, replSet);
}

Error condition in the above listed code will cause a crash for node.replSet == null condition while trying tot print that value.

This is generally unsafe and should rather be something like {{ (node.replSet ? node.replSet : "<null>") }} in the MONGOC_INFO.



 Comments   
Comment by Christian Hergert [ 19/Aug/14 ]

Fixed in master.

https://github.com/mongodb/mongo-c-driver/commit/6c4471936408179ad35afe33ea86a581ced0fe89

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