diff options
author | Robert Guo <robert.guo@10gen.com> | 2015-11-11 18:54:35 -0500 |
---|---|---|
committer | Robert Guo <robert.guo@10gen.com> | 2016-01-27 17:14:15 -0500 |
commit | e2835f1cbfcd47108bc1c077d886246c96dd5efe (patch) | |
tree | 1799f34bed10ce5b503e36bb32c2e1b223b489a4 /src | |
parent | 15e8b49669fdb4555acff2431fc9d5add48ca388 (diff) | |
download | mongo-e2835f1cbfcd47108bc1c077d886246c96dd5efe.tar.gz |
SERVER-21388 validate captrunc argument
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/test_commands.cpp | 5 |
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(); |