Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-916

Coverity analysis defect 67269: Dereference after null check

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.0-beta0
    • Affects Version/s: None
    • Component/s: None
    • None

      Pointer is checked against null but then dereferenced anyway

      Defect 67269 (STATIC_C)
      Checker FORWARD_NULL (subcategory none)
      File: /src/mongoc/mongoc-topology-description.c
      Function _mongoc_topology_description_update_rs_from_primary
      /src/mongoc/mongoc-topology-description.c, line: 892
      Comparing "server->set_name" to null implies that "server->set_name" might be null.

             if (!topology->set_name && server->set_name) {
      

      /src/mongoc/mongoc-topology-description.c, line: 895
      Passing null pointer "server->set_name" to "strcmp", which dereferences it.

             else if (strcmp(topology->set_name, server->set_name) != 0) {
      

            Assignee:
            bjori Hannes Magnusson
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: