summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neben <alexander.neben@mongodb.com>2022-08-11 14:30:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-11 14:53:34 +0000
commit4e4eea8e18803e697ef10df4516419371fe31937 (patch)
treea8ccec3f62363b36fe450fde3106eeb7b9c190dc
parentd890505f7ec3a446393e77f1c270ccbaf0630c66 (diff)
downloadmongo-4e4eea8e18803e697ef10df4516419371fe31937.tar.gz
SERVER-68714 Fixed shell secure number generation
-rw-r--r--src/mongo/shell/shell_utils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/shell/shell_utils.cpp b/src/mongo/shell/shell_utils.cpp
index 992f658f5f5..faa4e88c35d 100644
--- a/src/mongo/shell/shell_utils.cpp
+++ b/src/mongo/shell/shell_utils.cpp
@@ -185,7 +185,7 @@ BSONObj JSSrand(const BSONObj& a, void* data) {
// grab the least significant bits of either the supplied argument or
// a random number from SecureRandom.
if (a.nFields() == 1 && a.firstElement().isNumber())
- seed = static_cast<unsigned int>(a.firstElement().numberLong());
+ seed = static_cast<unsigned int>(a.firstElement().safeNumberLong());
else {
std::unique_ptr<SecureRandom> rand(SecureRandom::create());
seed = static_cast<unsigned int>(rand->nextInt64());