[Libreoffice-commits] core.git: desktop/source

Norbert Thiebaud nthiebaud at gmail.com
Mon Feb 18 19:06:15 PST 2013


 desktop/source/app/officeipcthread.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 6c8f448cffb88cbd320f6c694a296d6762426b36
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Feb 17 12:43:32 2013 -0600

    coverity#983483 String not null terminated
    
    Change-Id: I4cefa485b52afcdb761bfea99dd2515a206812a8
    Reviewed-on: https://gerrit.libreoffice.org/2199
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index d26cf08..8db7946 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -502,12 +502,18 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
             int nBytes = 0;
             int nBufSz = sc_nCSASeqLength + 1;
             // read byte per byte
+            pReceiveBuffer[0] = 0;
             while ((nResult=aStreamPipe.recv( pReceiveBuffer+nBytes, nBufSz-nBytes))>0) {
                 nBytes += nResult;
                 if (pReceiveBuffer[nBytes-1]=='\0') {
                     break;
                 }
             }
+            /* make sure the buffer is \0 terminated */
+            if (nBytes > 0)
+            {
+                pReceiveBuffer[nBytes-1] = 0;
+            }
             if (rtl::OString(sc_aSendArgumentsSequence).equals(pReceiveBuffer))
             {
                 // Pipe connected to first office


More information about the Libreoffice-commits mailing list