From 7ce33f903c55044082ff56b6f833741dabeb1858 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Mon, 15 Feb 2010 21:27:29 +0000 Subject: 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/qpid@910338 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/windows/SslAsynchIO.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cpp') diff --git a/cpp/src/qpid/sys/windows/SslAsynchIO.cpp b/cpp/src/qpid/sys/windows/SslAsynchIO.cpp index 2def2653b0..f57afa6254 100644 --- a/cpp/src/qpid/sys/windows/SslAsynchIO.cpp +++ b/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); -- cgit v1.2.1