summaryrefslogtreecommitdiffstats
path: root/lib/libtdekrb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libtdekrb')
-rw-r--r--lib/libtdekrb/src/tdekrbclientsocket.cpp17
-rw-r--r--lib/libtdekrb/src/tdekrbserversocket.cpp17
2 files changed, 28 insertions, 6 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;
diff --git a/lib/libtdekrb/src/tdekrbserversocket.cpp b/lib/libtdekrb/src/tdekrbserversocket.cpp
index 2b4d7d2..d99ddaa 100644
--- a/lib/libtdekrb/src/tdekrbserversocket.cpp
+++ b/lib/libtdekrb/src/tdekrbserversocket.cpp
@@ -171,7 +171,7 @@ bool TDEKerberosServerSocket::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 TDEKerberosServerSocket::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 TDEKerberosServerSocket::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 TDEKerberosServerSocket::readLine(char *data, TQ_ULONG maxlen) {
TQString TDEKerberosServerSocket::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 TDEKerberosServerSocket::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;