aboutsummaryrefslogtreecommitdiffhomepage
path: root/conformance/conformance_test_runner.cc
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2015-05-26 11:40:37 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2015-05-26 11:40:37 -0700
commit621bf8206543334bf59cda5ae7f4aade1fe337c7 (patch)
tree24bc1ea7d282dc37caf5c3a6d632d8546eb294ac /conformance/conformance_test_runner.cc
parent973bec13b3bb7d5347e63fc6d8a37cccacb2c042 (diff)
Null-terminate C strings.
Change-Id: I85675bfcd7697bb058b9af475445a6bfdd7fd967
Diffstat (limited to 'conformance/conformance_test_runner.cc')
-rw-r--r--conformance/conformance_test_runner.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc
index ca5877bd..e0bb50a5 100644
--- a/conformance/conformance_test_runner.cc
+++ b/conformance/conformance_test_runner.cc
@@ -143,8 +143,9 @@ class ForkPipeRunner : public google::protobuf::ConformanceTestRunner {
CHECK_SYSCALL(close(toproc_pipe_fd[1]));
CHECK_SYSCALL(close(fromproc_pipe_fd[0]));
- scoped_array<char> executable(new char[executable_.size()]);
+ scoped_array<char> executable(new char[executable_.size() + 1]);
memcpy(executable.get(), executable_.c_str(), executable_.size());
+ executable[executable_.size()] = '\0';
char *const argv[] = {executable.get(), NULL};
CHECK_SYSCALL(execv(executable.get(), argv)); // Never returns.