diff options
author | Mathias Stearn <mathias@10gen.com> | 2014-11-24 17:37:29 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2014-12-08 11:35:38 -0500 |
commit | 860f2856604b236d6048255a1bc308c9582cc7db (patch) | |
tree | 06afe5a42d73b641f94b2d301cfba75abbad6f4b /src/mongo/bson/bsonelement.h | |
parent | 403626141dde63d673db50417d484746079d027b (diff) | |
download | mongo-860f2856604b236d6048255a1bc308c9582cc7db.tar.gz |
SERVER-16258 Remove our strnlen and audit all callers
Our strnlen differed from the c standard by using int rather than size_t and
return -1 rather than the max length when not finding a NUL byte.
Diffstat (limited to 'src/mongo/bson/bsonelement.h')
-rw-r--r-- | src/mongo/bson/bsonelement.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h index e9d4e4b1939..67b345545ba 100644 --- a/src/mongo/bson/bsonelement.h +++ b/src/mongo/bson/bsonelement.h @@ -473,8 +473,8 @@ namespace mongo { totalSize = -1; fieldNameSize_ = -1; if ( maxLen != -1 ) { - int size = (int) strnlen( fieldName(), maxLen - 1 ); - uassert( 10333 , "Invalid field name", size != -1 ); + size_t size = strnlen( fieldName(), maxLen - 1 ); + uassert( 10333 , "Invalid field name", size < size_t(maxLen - 1) ); fieldNameSize_ = size + 1; } } |