diff options
author | Eliot Horowitz <eliot@10gen.com> | 2015-02-11 22:12:37 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2015-02-11 22:13:06 -0500 |
commit | 394a8569ff14a215c0691aa34440227b2e62a4de (patch) | |
tree | bd5de54c3ecbb8182ccd73b73cd0e225b72fadd0 /src/mongo/bson/bson_validate.cpp | |
parent | bc6725d28dd9339dcb3e07e14cfbe868eb4cd563 (diff) | |
download | mongo-394a8569ff14a215c0691aa34440227b2e62a4de.tar.gz |
SERVER-17264: improve bson validation for utf-8 strings
Diffstat (limited to 'src/mongo/bson/bson_validate.cpp')
-rw-r--r-- | src/mongo/bson/bson_validate.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/bson/bson_validate.cpp b/src/mongo/bson/bson_validate.cpp index cd11f4bb77a..5e0a0341909 100644 --- a/src/mongo/bson/bson_validate.cpp +++ b/src/mongo/bson/bson_validate.cpp @@ -90,6 +90,11 @@ namespace mongo { if ( !readNumber<int>( &sz ) ) return makeError("invalid bson", _idElem); + if ( sz <= 0 ) { + // must have NULL at the very least + return makeError("invalid bson", _idElem); + } + if ( out ) { *out = StringData( _buffer + _position, sz ); } |