summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/framing/Buffer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/cpp/src/qpid/framing/Buffer.cpp b/cpp/src/qpid/framing/Buffer.cpp
index 9c089fd0f8..459aa3881b 100644
--- a/cpp/src/qpid/framing/Buffer.cpp
+++ b/cpp/src/qpid/framing/Buffer.cpp
@@ -220,14 +220,16 @@ void Buffer::putUInt<8>(uint64_t i) {
}
void Buffer::putShortString(const string& s){
- uint8_t len = s.length();
+ size_t slen = s.length();
+ uint8_t len = slen < 0x100 ? (uint8_t) slen : 0xFF;
putOctet(len);
s.copy(data + position, len);
position += len;
}
void Buffer::putMediumString(const string& s){
- uint16_t len = s.length();
+ size_t slen = s.length();
+ uint16_t len = slen < 0x10000 ? (uint16_t) slen : 0xFFFF;
putShort(len);
s.copy(data + position, len);
position += len;