diff options
author | yingdongyuan <yingdongyuan@deeproute.ai> | 2021-06-04 12:44:30 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-04 20:54:01 +0000 |
commit | 285b313a0571fc6b648f123277cbdce3d0202a2d (patch) | |
tree | ce460e13ef7b94f24fdaff5777aadf5d1ba709b5 /src/mongo/scripting | |
parent | cc5fdbf33c483c43a8b6d2e0f9484989a7e9e2fe (diff) | |
download | mongo-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.cpp | 3 |
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) { |