summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2009-09-09 16:28:59 -0400
committerDwight <dmerriman@gmail.com>2009-09-09 16:28:59 -0400
commitfcf361cb2ca13a55b68b99e9a7af9dea48e18a30 (patch)
tree9279f4acf871c9251813a7dd1531d90ea307e558
parentb860415ae2a09bb3f81c7c37478017f47b11fe0d (diff)
downloadmongo-fcf361cb2ca13a55b68b99e9a7af9dea48e18a30.tar.gz
don't crash if ns len too long
-rw-r--r--db/cursor.cpp2
-rw-r--r--db/namespace.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/db/cursor.cpp b/db/cursor.cpp
index f61fc6f5b42..fe8673ce70c 100644
--- a/db/cursor.cpp
+++ b/db/cursor.cpp
@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../stdafx.h"
+#include "stdafx.h"
#include "pdfile.h"
namespace mongo {
diff --git a/db/namespace.h b/db/namespace.h
index 47a404af3e1..dd04d8526f1 100644
--- a/db/namespace.h
+++ b/db/namespace.h
@@ -84,6 +84,7 @@ namespace mongo {
*this = ns;
}
Namespace& operator=(const char *ns) {
+ uassert("ns name too long, max size is 128", strlen(ns) < MaxNsLen);
memset(buf, 0, MaxNsLen); /* this is just to keep stuff clean in the files for easy dumping and reading */
strcpy_s(buf, MaxNsLen, ns);
return *this;