diff options
author | Tad Marshall <tad@10gen.com> | 2012-08-07 11:36:21 -0400 |
---|---|---|
committer | Tad Marshall <tad@10gen.com> | 2012-08-07 13:43:20 -0400 |
commit | aec02b62d192a56b647e6f28afbe5bfdec9b2e92 (patch) | |
tree | d9a1c9bb4c987d705e0ba1fa048b2f19f2f9f988 /src/mongo | |
parent | 517dfc979a509adfbabd4e5fa21b3e101ebcb3fa (diff) | |
download | mongo-aec02b62d192a56b647e6f28afbe5bfdec9b2e92.tar.gz |
SERVER-6559 do not segfault parsing collection name
Rework two lines of code to not crash on missing periods in
namespace names being checked for correctness.
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/namespacestring.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/namespacestring.h b/src/mongo/db/namespacestring.h index 2bffa45e9ef..58448b1d2fb 100644 --- a/src/mongo/db/namespacestring.h +++ b/src/mongo/db/namespacestring.h @@ -113,8 +113,8 @@ namespace mongo { * @return if db.coll is an allowed collection name */ static bool validCollectionName(const char* dbcoll){ - const char *c = strchr( dbcoll, '.' ) + 1; - return normal(dbcoll) && c && *c; + const char *c = strchr( dbcoll, '.' ); + return (c != NULL) && (c[1] != '\0') && normal(dbcoll); } private: |