summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-29 10:40:32 -0400
committerEliot Horowitz <eliot@10gen.com>2010-03-29 10:41:04 -0400
commitd979fd7da676eb255294bccaf9e18b7599ba169c (patch)
tree8b3971454428d332a9cfe904efe1111dfe3c147c
parent6de759673dba3e69c1b9148403c54a30107cedef (diff)
downloadmongo-d979fd7da676eb255294bccaf9e18b7599ba169c.tar.gz
catch empty db names early SERVER-821
-rw-r--r--db/db.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/db/db.h b/db/db.h
index 0bbc97b5380..78fc98d9158 100644
--- a/db/db.h
+++ b/db/db.h
@@ -141,8 +141,11 @@ namespace mongo {
string _todb( const string& ns ) const {
size_t i = ns.find( '.' );
- if ( i == string::npos )
+ if ( i == string::npos ){
+ uassert( 13074 , "db name can't be empty" , ns.size() );
return ns;
+ }
+ uassert( 13075 , "db name can't be empty" , i > 0 );
return ns.substr( 0 , i );
}