Skip to content

Commit 201c13c

Browse files
Fixing invalid null char for output when running shell command
1 parent 9d46365 commit 201c13c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Src/runcpp2/PlatformUtil.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ bool runcpp2::RunCommandAndGetOutput( const std::string& command,
104104
sys2Result =
105105
System2ReadFromOutput( &commandInfo,
106106
const_cast<char*>(outOutput.data()) + outOutput.size() - 4096,
107-
4096 - 1,
107+
4096,
108108
&byteRead);
109109

110-
outOutput.resize(outOutput.size() - 4096 + byteRead + 1);
111-
outOutput.back() = '\0';
110+
outOutput.resize(outOutput.size() + byteRead);
112111
}
113112
while(sys2Result == SYSTEM2_RESULT_READ_NOT_FINISHED);
114113

0 commit comments

Comments
 (0)