mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: make sure Utf8Value always zero-terminates
Make sure dereferencing a `Utf8Value` instance always returns
a zero-terminated string, even if the conversion to string failed.
The corresponding bugfix in the master branch happened in 44a40325da
(https://github.com/nodejs/node/pull/6357).
Ref: https://github.com/nodejs/node/pull/6357
PR-URL: https://github.com/nodejs/node/pull/7101
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
This commit is contained in:
1 parent
a31153c02c
commit
037291e31f
1 file changed
+4
@@ -5,6 +5,10 @@ namespace node {
|
||||
|
||||
Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> value)
|
||||
: length_(0), str_(str_st_) {
|
||||
// Make sure result is always zero-terminated, even if conversion to string
|
||||
// fails.
|
||||
str_st_[0] = '\0';
|
||||
|
||||
if (value.IsEmpty())
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user