diff options
-rw-r--r-- | src/util.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util.cc b/src/util.cc index 3b0278ceda..20325d0bed 100644 --- a/src/util.cc +++ b/src/util.cc @@ -47,7 +47,9 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) return; // Allocate enough space to include the null terminator - size_t len = StringBytes::StorageSize(isolate, string, UCS2) + 1; + size_t len = + StringBytes::StorageSize(isolate, string, UCS2) + + sizeof(uint16_t); if (len > sizeof(str_st_)) { str_ = static_cast<uint16_t*>(malloc(len)); CHECK_NE(str_, nullptr); |