diff options
| author | Stephen D. Huston <shuston@apache.org> | 2008-12-23 18:21:04 +0000 |
|---|---|---|
| committer | Stephen D. Huston <shuston@apache.org> | 2008-12-23 18:21:04 +0000 |
| commit | 912a6db37456524c60e1b7f3236de4dca3c77636 (patch) | |
| tree | c9e9a83ae93de97f1cf67a17e342a72d0e17dd6a /cpp/src/qpid | |
| parent | 86ea8ed684548adf017250ed80083e7d8c843b3e (diff) | |
| download | qpid-python-912a6db37456524c60e1b7f3236de4dca3c77636.tar.gz | |
Fix encoding 0-length values; resolves QPID-1449
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@729054 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/framing/FieldValue.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cpp/src/qpid/framing/FieldValue.h b/cpp/src/qpid/framing/FieldValue.h index 8a2d9e49e3..29760619e5 100644 --- a/cpp/src/qpid/framing/FieldValue.h +++ b/cpp/src/qpid/framing/FieldValue.h @@ -193,12 +193,14 @@ class VariableWidthValue : public FieldValue::Data { uint32_t encodedSize() const { return lenwidth + octets.size(); } void encode(Buffer& buffer) { buffer.putUInt<lenwidth>(octets.size()); - buffer.putRawData(&octets[0], octets.size()); + if (octets.size() > 0) + buffer.putRawData(&octets[0], octets.size()); }; void decode(Buffer& buffer) { uint32_t len = buffer.getUInt<lenwidth>(); octets.resize(len); - buffer.getRawData(&octets[0], len); + if (len > 0) + buffer.getRawData(&octets[0], len); } bool operator==(const Data& d) const { const VariableWidthValue<lenwidth>* rhs = dynamic_cast< const VariableWidthValue<lenwidth>* >(&d); |
