summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
diff options
context:
space:
mode:
authoryingdongyuan <yingdongyuan@deeproute.ai>2021-06-04 12:44:30 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-04 20:54:01 +0000
commit285b313a0571fc6b648f123277cbdce3d0202a2d (patch)
treece460e13ef7b94f24fdaff5777aadf5d1ba709b5 /src/mongo/scripting
parentcc5fdbf33c483c43a8b6d2e0f9484989a7e9e2fe (diff)
downloadmongo-285b313a0571fc6b648f123277cbdce3d0202a2d.tar.gz
SERVER-57206 Resolve Compiler warnings in JSStringWrapper::JSStringWrapper
Signed-off-by: Andrew Morrow <acm@mongodb.com> Closes #1404
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/mozjs/jsstringwrapper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/scripting/mozjs/jsstringwrapper.cpp b/src/mongo/scripting/mozjs/jsstringwrapper.cpp
index 7f68ae6a47d..3c01ce3e665 100644
--- a/src/mongo/scripting/mozjs/jsstringwrapper.cpp
+++ b/src/mongo/scripting/mozjs/jsstringwrapper.cpp
@@ -45,7 +45,8 @@ namespace mozjs {
JSStringWrapper::JSStringWrapper(std::int32_t value) : _isSet(true) {
auto formatted = fmt::format_int(value);
_length = formatted.size();
- strncpy(_buf, formatted.c_str(), sizeof(_buf));
+ strncpy(_buf, formatted.c_str(), sizeof(_buf) - 1);
+ _buf[sizeof(_buf) - 1] = '\0';
}
JSStringWrapper::JSStringWrapper(JSContext* cx, JSString* str) : _isSet(true) {