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

Coverity analysis defect 102291: Wrong sizeof argument

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      The sizeof operator is invoked on the wrong argument

      Defect 102291 (STATIC_C)
      Checker SIZEOF_MISMATCH (subcategory wrong_sizeof)
      File: /src/bson/bson-reader.c
      Function _bson_reader_data_read
      /src/bson/bson-reader.c, line: 574
      Passing argument "&reader->data[reader->offset]" of type "uint8_t const " and argument "4UL" ("sizeof (blen)") to function "memcpy" is suspicious because "sizeof (uint8_t const) /*1/" is expected.

                memcpy (&blen, &reader->data[reader->offset], sizeof blen);

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: