diff options
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(); |