Skip to content

Commit

Permalink
Avoid sending a spurious null byte to the server at the end of raw co…
Browse files Browse the repository at this point in the history
…mmands (#2565)
  • Loading branch information
ctrlaltca authored Nov 21, 2023
1 parent 85e5878 commit a0f2687
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/kvirc/kernel/KviIrcConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,12 @@ bool KviIrcConnection::sendData(const char * pcBuffer, int iBuflen)
m_pConsole->outputNoFmt(KVI_OUT_SOCKETWARNING, __tr2qs("[LINK WARNING]: Socket message truncated to 512 bytes."));
}

KviDataBuffer * pData = new KviDataBuffer(iBuflen + 3);
KviDataBuffer * pData = new KviDataBuffer(iBuflen + 2);
KviMemory::move(pData->data(), pcBuffer, iBuflen);
*(pData->data() + iBuflen) = '\r';
*(pData->data() + iBuflen + 1) = '\n';
*(pData->data() + iBuflen + 2) = '\0';

QString szMsg = (const char *)(pData->data());
szMsg.truncate(iBuflen);
QString szMsg = QString::fromUtf8((const char *)(pData->data()), iBuflen);

// notify the monitors
for(auto & m : context()->monitorList())
Expand Down

0 comments on commit a0f2687

Please sign in to comment.