[CDRIVER-2597] Coverity analysis defect 102291: Wrong sizeof argument Created: 05/Apr/18  Updated: 27/Oct/23  Resolved: 05/Apr/18

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: A. Jesse Jiryu Davis
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Resolve Coverity Warnings

 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);


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