Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 44a4032
(#6357).
  • Loading branch information
addaleax committed Jun 2, 2016
commit 7f072d722bd875f9f787586724cc242260560f18
4 changes: 4 additions & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down