-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Return value of function which returns null is dereferenced without checking
Defect 76371 (STATIC_C)
Checker NULL_RETURNS (subcategory none)
File: /src/mongoc/mongoc-collection.c
Function mongoc_collection_create_index
/src/mongoc/mongoc-collection.c, line: 821
Assigning: "alloc_name" = null return value from "mongoc_collection_keys_to_index_string".
alloc_name = mongoc_collection_keys_to_index_string (keys);
/src/mongoc/mongoc-collection.c, line: 822
Assigning: "name" = "alloc_name". Both pointers are now null.
name = alloc_name;
/src/mongoc/mongoc-collection.c, line: 832
Dereferencing a pointer that might be null "name" when calling "strlen".
BSON_APPEND_UTF8 (&doc, "name", name);