diff --git a/src/util.cc b/src/util.cc index 903fbbba134bd9..858e4b396534b3 100644 --- a/src/util.cc +++ b/src/util.cc @@ -5,6 +5,10 @@ namespace node { Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local 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;