summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/test_commands.cpp
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2015-11-11 18:54:35 -0500
committerRobert Guo <robert.guo@10gen.com>2015-11-12 11:11:47 -0500
commit5d72d90de73df52707c31f6799bc4624752d08a2 (patch)
tree2f2a3aee0139d66b849b95bb7df05d0098577d1a /src/mongo/db/commands/test_commands.cpp
parent21fe3e04acd53ad7888f4b8648f816788243aa33 (diff)
downloadmongo-5d72d90de73df52707c31f6799bc4624752d08a2.tar.gz
SERVER-21388 validate captrunc argument
Diffstat (limited to 'src/mongo/db/commands/test_commands.cpp')
-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();