Skip to content

Commit d38a026

Browse files
committed
CID-102166 (Coverity) guard against out-of-bounds read
1 parent 8e93b37 commit d38a026

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libmongoc/tests/mock_server/request.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ request_from_op_msg (request_t *request, const mongoc_rpc_t *rpc)
10971097
bson_iter_t iter;
10981098
bson_string_t *msg_as_str = bson_string_new ("OP_MSG");
10991099

1100+
BSON_ASSERT (rpc->msg.n_sections <= 2);
11001101
for (section_no = 0; section_no < rpc->msg.n_sections; section_no++) {
11011102
bson_string_append (msg_as_str, (section_no > 0 ? ", " : " "));
11021103
section = &rpc->msg.sections[section_no];

0 commit comments

Comments
 (0)