summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-06-26 22:13:33 +0000
committerStephen D. Huston <shuston@apache.org>2009-06-26 22:13:33 +0000
commit965a3fcd313339d08e6025ef37e3a17ccc929ebe (patch)
treebd3de46b7cf230799f1bf087f1c132eb926144ae /cpp/src
parent3851ab7c8e7668638d4e0fb4627db96013a753c6 (diff)
downloadqpid-python-965a3fcd313339d08e6025ef37e3a17ccc929ebe.tar.gz
Fix out-of-range vector access; fixes QPID-1957
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@788886 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/framing/FrameDecoder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpp/src/qpid/framing/FrameDecoder.cpp b/cpp/src/qpid/framing/FrameDecoder.cpp
index 1e73ee1e51..529cdd76a7 100644
--- a/cpp/src/qpid/framing/FrameDecoder.cpp
+++ b/cpp/src/qpid/framing/FrameDecoder.cpp
@@ -32,7 +32,8 @@ namespace {
/** Append up to n bytes from start of buf to end of bytes. */
void append(std::vector<char>& bytes, Buffer& buffer, size_t n) {
size_t oldSize = bytes.size();
- n = std::min(n, size_t(buffer.available()));
+ if ((n = std::min(n, size_t(buffer.available()))) == 0)
+ return;
bytes.resize(oldSize+n);
char* p = &bytes[oldSize];
buffer.getRawData(reinterpret_cast<uint8_t*>(p), n);