summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2010-02-15 21:27:29 +0000
committerStephen D. Huston <shuston@apache.org>2010-02-15 21:27:29 +0000
commitdd6cd1b9f7892cdfdc3e27b805b6152e9b35eac9 (patch)
treefabe156c5ecf27cfa706018ee4277eebc7929e8a
parenta2469e35c26e32129d2284fac0645918e27dec30 (diff)
downloadqpid-python-dd6cd1b9f7892cdfdc3e27b805b6152e9b35eac9.tar.gz
When handling coalesced sets of SSL segments, ensure the buffer obtained to hold the extra data is big enough. Resolves QPID-2407.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@910338 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp b/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp
index 2def2653b0..f57afa6254 100644
--- a/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp
+++ b/qpid/cpp/src/qpid/sys/windows/SslAsynchIO.cpp
@@ -145,7 +145,7 @@ void SslAsynchIO::queueWrite(AsynchIO::BufferBase* buff) {
assert(sslBuff != 0);
// Encrypt and hand off to the io layer. Remember that the upper layer's
- // encoding was working on, and adjustoing counts for, the SslIoBuff.
+ // encoding was working on, and adjusting counts for, the SslIoBuff.
// Update the count of the original BufferBase before handing off to
// the I/O layer.
buff = sslBuff->release();
@@ -340,7 +340,14 @@ void SslAsynchIO::sslDataIn(qpid::sys::AsynchIO& a, BufferBase *buff) {
buff->dataCount -= recvBuffs[i].cbBuffer;
break;
case SECBUFFER_EXTRA:
- extraBuff = getQueuedBuffer();
+ // Very important to get this buffer from the downstream aio.
+ // The ones constructed from the local getQueuedBuffer() are
+ // restricted size for encrypting. However, data coming up from
+ // TCP may have a bunch of SSL segments coalesced and be much
+ // larger than the maximum single SSL segment.
+ extraBuff = a.getQueuedBuffer();
+ if (0 == extraBuff)
+ throw QPID_WINDOWS_ERROR(WSAENOBUFS);
memmove(extraBuff->bytes,
recvBuffs[i].pvBuffer,
recvBuffs[i].cbBuffer);