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

Coverity analysis defect 72298: Time of check time of use

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      A check occurs on a file's attributes before the file is used in a privileged operation, but things may have changed

      Defect 72298 (STATIC_C)
      Checker TOCTOU (subcategory none)
      File: /examples/mongoc-dump.c
      Function mongoc_dump_collection
      /examples/mongoc-dump.c, line: 64
      Calling function "access" to perform check on "path".

             if (0 == access (path, F_OK)) {
      

      /examples/mongoc-dump.c, line: 65
      Calling function "unlink" that uses "path" after a check function. This can cause a time-of-check, time-of-use race condition.

                unlink (path);
      

      File: /examples/mongoc-dump.c
      Function mongoc_dump_collection
      /examples/mongoc-dump.c, line: 64
      Calling function "access" to perform check on "path".

             if (0 == access (path, F_OK)) {
      

      /examples/mongoc-dump.c, line: 69
      Calling function "fopen" that uses "path" after a check function. This can cause a time-of-check, time-of-use race condition.

             stream = fopen (path, "w");
      

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: