summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2012-08-07 11:36:21 -0400
committerTad Marshall <tad@10gen.com>2012-08-07 13:43:20 -0400
commitaec02b62d192a56b647e6f28afbe5bfdec9b2e92 (patch)
treed9a1c9bb4c987d705e0ba1fa048b2f19f2f9f988 /src/mongo
parent517dfc979a509adfbabd4e5fa21b3e101ebcb3fa (diff)
downloadmongo-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.h4
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: