Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Lubos Lunak wrote
On Tuesday 19 of February 2013, Julien Nabet wrote:
diff --git a/desktop/source/app/officeipcthread.cxx
b/desktop/source/app/officeipcthread.cxx index 8db7946..445ccb4 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -497,23 +497,17 @@ OfficeIPCThread::Status
OfficeIPCThread::EnableOfficeIPCThread() else if( pThread->maPipe.create(
aPipeIdent.getStr(), osl_Pipe_OPEN, rSecurity )) // Creation not
successfull, now we try to connect {
             osl::StreamPipe aStreamPipe(pThread->maPipe.getHandle());
-            char pReceiveBuffer[sc_nCSASeqLength + 1];
+            char pReceiveBuffer[sc_nCSASeqLength + 1] = {0};
             int nResult = 0;
             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;
-            }
 Did you really mean to remove this part?

Hi Lubos,

Yes I meant it, why? Is it wrong?
if "pReceiveBuffer" is initialized with 0 for the (sc_nCSASeqLength + 1)
elements thanks to = {0} initialization, what obvious thing did I miss? Why
"pReceiveBuffer[nBytes-1] = 0;" would need to stay?

Of course, if my commit is wrong, I'll revert it after my day time job

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/Re-Libreoffice-commits-core-git-desktop-source-tp4038892p4038893.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.