summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2015-11-11 18:54:35 -0500
committerRobert Guo <robert.guo@10gen.com>2016-01-27 17:14:15 -0500
commite2835f1cbfcd47108bc1c077d886246c96dd5efe (patch)
tree1799f34bed10ce5b503e36bb32c2e1b223b489a4 /src
parent15e8b49669fdb4555acff2431fc9d5add48ca388 (diff)
downloadmongo-e2835f1cbfcd47108bc1c077d886246c96dd5efe.tar.gz
SERVER-21388 validate captrunc argument
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/test_commands.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index fcfafbf5607..485998c4e3a 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -228,6 +228,11 @@ public:
int n = cmdObj.getIntField("n");
bool inc = cmdObj.getBoolField("inc"); // inclusive range?
+ if (n <= 0) {
+ return appendCommandStatus(result,
+ {ErrorCodes::BadValue, "n must be a positive integer"});
+ }
+
OldClientWriteContext ctx(txn, fullNs);
Collection* collection = ctx.getCollection();