summaryrefslogtreecommitdiffstats
path: root/dcop
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-26 22:23:30 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-26 22:23:30 +0000
commit946bde4a62fa9c4c47315defb2e31cf54d821246 (patch)
tree4c8722f3db4e1cc5800519d00ccd30c60c50dd3d /dcop
parenta20928b6bfae18a41bb42b85e10f73fb63548ccc (diff)
downloadtdelibs-946bde4a62fa9c4c47315defb2e31cf54d821246.tar.gz
tdelibs-946bde4a62fa9c4c47315defb2e31cf54d821246.zip
Patch a few buffer overrun problems and odd crash potentials
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1217371 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dcop')
-rw-r--r--dcop/client/marshall.cpp2
-rw-r--r--dcop/dcopserver.cpp13
-rw-r--r--dcop/dcopserver.h2
3 files changed, 11 insertions, 6 deletions
diff --git a/dcop/client/marshall.cpp b/dcop/client/marshall.cpp
index 496880aad..27a73495b 100644
--- a/dcop/client/marshall.cpp
+++ b/dcop/client/marshall.cpp
@@ -177,7 +177,7 @@ TQCString demarshal( TQDataStream &stream, const TQString &type )
TQBuffer buf( ba );
buf.open( IO_WriteOnly );
i.save( &buf, "XPM" );
- result = ba;
+ result = buf.buffer();
} else if ( type == "TQPoint" )
{
TQPoint p;
diff --git a/dcop/dcopserver.cpp b/dcop/dcopserver.cpp
index ca810f390..ef37f0a32 100644
--- a/dcop/dcopserver.cpp
+++ b/dcop/dcopserver.cpp
@@ -131,6 +131,7 @@ static TQCString readQCString(TQDataStream &ds)
if ((bytesLeft < 0 ) || (len > (uint) bytesLeft))
{
qWarning("Corrupt data!\n");
+ printf("bytesLeft: %d, len: %d\n", bytesLeft, len);
return result;
}
result.TQByteArray::resize( (uint)len );
@@ -240,7 +241,7 @@ void DCOPIceWriteChar(register IceConn iceConn, unsigned long nbytes, char *ptr)
{
DCOPConnection* conn = the_server->findConn( iceConn );
#ifdef DCOP_DEBUG
-qWarning("DCOPServer: DCOPIceWriteChar() Writing %d bytes to %d [%s]", nbytes, fd, conn ? conn->appId.data() : "<unknown>");
+qWarning("DCOPServer: DCOPIceWriteChar() Writing %d bytes [%s]", nbytes, conn ? conn->appId.data() : "<unknown>");
#endif
if (conn)
@@ -272,7 +273,7 @@ static void DCOPIceWrite(IceConn iceConn, const TQByteArray &_data)
{
DCOPConnection* conn = the_server->findConn( iceConn );
#ifdef DCOP_DEBUG
-qWarning("DCOPServer: DCOPIceWrite() Writing %d bytes to %d [%s]", _data.size(), fd, conn ? conn->appId.data() : "<unknown>");
+qWarning("DCOPServer: DCOPIceWrite() Writing %d bytes [%s]", _data.size(), conn ? conn->appId.data() : "<unknown>");
#endif
if (conn)
{
@@ -1518,7 +1519,9 @@ bool DCOPServer::receive(const TQCString &/*app*/, const TQCString &obj,
TQCString slot = readQCString(args);
TQ_INT8 Volatile;
args >> Volatile;
- //qDebug("DCOPServer: connectSignal(sender = %s senderObj = %s signal = %s recvObj = %s slot = %s)", sender.data(), senderObj.data(), signal.data(), receiverObj.data(), slot.data());
+#ifdef DCOP_DEBUG
+ qDebug("DCOPServer: connectSignal(sender = %s senderObj = %s signal = %s recvObj = %s slot = %s)", sender.data(), senderObj.data(), signal.data(), receiverObj.data(), slot.data());
+#endif
bool b = dcopSignals->connectSignal(sender, senderObj, signal, conn, receiverObj, slot, (Volatile != 0));
replyType = "bool";
TQDataStream reply( replyData, IO_WriteOnly );
@@ -1534,7 +1537,9 @@ bool DCOPServer::receive(const TQCString &/*app*/, const TQCString &obj,
TQCString signal = readQCString(args);
TQCString receiverObj = readQCString(args);
TQCString slot = readQCString(args);
- //qDebug("DCOPServer: disconnectSignal(sender = %s senderObj = %s signal = %s recvObj = %s slot = %s)", sender.data(), senderObj.data(), signal.data(), receiverObj.data(), slot.data());
+#ifdef DCOP_DEBUG
+ qDebug("DCOPServer: disconnectSignal(sender = %s senderObj = %s signal = %s recvObj = %s slot = %s)", sender.data(), senderObj.data(), signal.data(), receiverObj.data(), slot.data());
+#endif
bool b = dcopSignals->disconnectSignal(sender, senderObj, signal, conn, receiverObj, slot);
replyType = "bool";
TQDataStream reply( replyData, IO_WriteOnly );
diff --git a/dcop/dcopserver.h b/dcop/dcopserver.h
index 7abc6497a..0a5d96f0e 100644
--- a/dcop/dcopserver.h
+++ b/dcop/dcopserver.h
@@ -55,7 +55,7 @@ class TQTimer;
// If you enable the following define DCOP will create
// $HOME/.dcop.log file which will list all signals passing
// through it.
-//#define DCOP_LOG
+// #define DCOP_LOG
#ifdef DCOP_LOG
class TQTextStream;
class TQFile;