summaryrefslogtreecommitdiff
path: root/src/node_buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r--src/node_buffer.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 11317328a6..2503274446 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -612,8 +612,10 @@ void Fill(const FunctionCallbackInfo<Value>& args) {
size_t in_there = str_length;
char* ptr = ts_obj_data + start + str_length;
- if (str_length == 0)
+ if (str_length == 0) {
+ memset(ts_obj_data + start, 0, length);
return;
+ }
memcpy(ts_obj_data + start, *str, MIN(str_length, length));