diff options
Diffstat (limited to 'lib/libtdekrb/src/tdekrbclientsocket.cpp')
-rw-r--r-- | lib/libtdekrb/src/tdekrbclientsocket.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libtdekrb/src/tdekrbclientsocket.cpp b/lib/libtdekrb/src/tdekrbclientsocket.cpp index 647da73..96833a2 100644 --- a/lib/libtdekrb/src/tdekrbclientsocket.cpp +++ b/lib/libtdekrb/src/tdekrbclientsocket.cpp @@ -171,7 +171,7 @@ bool TDEKerberosClientSocket::atEnd() const { bool ret; if (m_kerberosRequested) { - return (m_buffer->at() >= (unsigned long)m_bufferLength); + ret = TQSocket::atEnd(); } else { ret = TQSocket::atEnd(); @@ -230,6 +230,9 @@ TQ_LONG TDEKerberosClientSocket::readBlock(char *data, TQ_ULONG maxlen) { } free(buf); + if (maxlen > (unsigned int)m_bufferLength) { + maxlen = m_bufferLength; + } m_buffer->at(0); ret = m_buffer->readBlock(data, maxlen); if (ret > 0) { @@ -284,6 +287,9 @@ TQ_LONG TDEKerberosClientSocket::readLine(char *data, TQ_ULONG maxlen) { } free(buf); + if (maxlen > (unsigned int)m_bufferLength) { + maxlen = m_bufferLength; + } m_buffer->at(0); ret = m_buffer->readLine(data, maxlen); if (ret > 0) { @@ -310,11 +316,13 @@ TQ_LONG TDEKerberosClientSocket::readLine(char *data, TQ_ULONG maxlen) { TQString TDEKerberosClientSocket::readLine() { long i; TQString ret; + long maxlen; if (m_kerberosRequested) { int reclen; int wrlen; int readlen; + maxlen = m_negotiatedMaxBufferSize; char* buf = (char*)malloc(m_negotiatedMaxBufferSize); reclen = receiveEncryptedData(buf, m_negotiatedMaxBufferSize); if (reclen > 0) { @@ -326,9 +334,12 @@ TQString TDEKerberosClientSocket::readLine() { } free(buf); + if (maxlen > m_bufferLength) { + maxlen = m_bufferLength; + } m_buffer->at(0); - buf = (char*)malloc(m_negotiatedMaxBufferSize); - readlen = m_buffer->readLine(buf, m_negotiatedMaxBufferSize); + buf = (char*)malloc(maxlen); + readlen = m_buffer->readLine(buf, maxlen); if (readlen > 0) { // Remove the read bytes from the buffer m_bufferLength = m_bufferLength-readlen; |