diff options
author | Matt Kneiser <matt.kneiser@mongodb.com> | 2022-01-13 00:22:12 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-13 06:29:13 +0000 |
commit | fd6b2a875f8942a4ba7fea916b4c52a913e14f49 (patch) | |
tree | 8e18dd580f8d03a42f27ed7af357cae38a2ff745 /src/mongo/util/strong_weak_finish_line_test.cpp | |
parent | 47c77eedf3bb0b4305f2ca1d8e362b27d599008f (diff) | |
download | mongo-fd6b2a875f8942a4ba7fea916b4c52a913e14f49.tar.gz |
SERVER-27209 Eliminate dangerous BSONElement string extraction methods
- Fix: Change return type of BSONObj::getStringField to include size
(StringData vs. char*). A char* only contains the data with an ending NULL
termination. Whereas a StringData contains data + size so caller knows how
to interpret data if there are embedded NULLs.
- Cleanup: Remove old tag - CachedSizeTag - that disambiguated BSONElement ctors.
A dangling reference to 'maxLen' in a comment led me to this historical issue.
$ git log -S'maxLen' -- src/mongo/bson/bsonelement.h
commit 0d38ef5
Author: Mathias Stearn mathias@10gen.com
Date: Tue Dec 19 14:23:08 2017 -0500
SERVER-32302 Compute BSONElement sizes eagerly
- Test: Add tests for NULL bytes being returned by getStringField
- $ ninja -j400 +bson_obj_test
- Cleanup: Move BSONElement::valuestr() from public to private
- Cleanup: Remove BSONElement::valuestrsafe()
- Cleanup: Remove all external callers of valuestr/valuestrsafe and cleanup
their callsites with better alternatives.
- Cleanup: Make multi-line BSONElement & BSONObj public API comments
conform to style guidelines
- Nit: Fix spelling in a comment
Diffstat (limited to 'src/mongo/util/strong_weak_finish_line_test.cpp')
0 files changed, 0 insertions, 0 deletions