Kaydet (Commit) 6c8f448c authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

coverity#983483 String not null terminated

Change-Id: I4cefa485b52afcdb761bfea99dd2515a206812a8
Reviewed-on: https://gerrit.libreoffice.org/2199Reviewed-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
Tested-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
üst 6e6af994
...@@ -502,12 +502,18 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() ...@@ -502,12 +502,18 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
int nBytes = 0; int nBytes = 0;
int nBufSz = sc_nCSASeqLength + 1; int nBufSz = sc_nCSASeqLength + 1;
// read byte per byte // read byte per byte
pReceiveBuffer[0] = 0;
while ((nResult=aStreamPipe.recv( pReceiveBuffer+nBytes, nBufSz-nBytes))>0) { while ((nResult=aStreamPipe.recv( pReceiveBuffer+nBytes, nBufSz-nBytes))>0) {
nBytes += nResult; nBytes += nResult;
if (pReceiveBuffer[nBytes-1]=='\0') { if (pReceiveBuffer[nBytes-1]=='\0') {
break; break;
} }
} }
/* make sure the buffer is \0 terminated */
if (nBytes > 0)
{
pReceiveBuffer[nBytes-1] = 0;
}
if (rtl::OString(sc_aSendArgumentsSequence).equals(pReceiveBuffer)) if (rtl::OString(sc_aSendArgumentsSequence).equals(pReceiveBuffer))
{ {
// Pipe connected to first office // Pipe connected to first office
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment