diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index d03785056d..b69ecccd6b 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -2202,8 +2202,9 @@ bool GetEvaluateStringResult(char *message, char* buffer, int buffer_size) { if (pos == NULL) { return false; } - Vector buf(buffer, buffer_size - 1); - OS::StrNCpy(buf, pos, buffer_size); + Vector buf(buffer, buffer_size); + OS::StrNCpy(buf, pos, buffer_size - 1); + buffer[buffer_size - 1] = '\0'; return true; }