[CXX-730] string_view.data() is unsafe Created: 04/Nov/15  Updated: 11/Jan/16  Resolved: 18/Dec/15

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

Type: Bug Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CXX-739 Add variant type for string_view_or_v... Closed
is duplicated by CXX-729 Look into the use of string_view .data() Closed
Epic Link: C++11 Driver MongoDB 3.2

 Description   

string_view.data() isn't guaranteed to return a null-terminated string. The C driver methods we use expect to get null-terminated strings. We need to find all places we pass strings from string_view's through to the C driver, and make sure we are doing this correctly.

For more background:
https://github.com/mongodb/mongo-cxx-driver/pull/367#discussion_r43909065



 Comments   
Comment by Andrew Morrow (Inactive) [ 18/Dec/15 ]

samantha.ritter - Closing this as a duplicate of CXX-739. I updated that ticket description to include ensuring that we only pass NULL terminated strings into the C driver when there is no explicit length. It seemed easier to just have one ticket to track.

Comment by Andrew Morrow (Inactive) [ 11/Dec/15 ]

samantha.ritter - Should we just close this issue in favor of doing that work as part of CXX-739?

Comment by Matt Cotter [ 13/Nov/15 ]

I think CXX-739 will fix this issue entirely.

Generated at Wed Feb 07 22:00:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.