mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-17 11:05:05 +02:00
Don't send binary values to output stream
The stringification of a msgpack object shouldn't write the raw bytes of a binary value. It will likely make the result unprintable. Just print that it's a binary blob and include the size. E.g., {"data":BIN(1032256)} EXT is handled similarly but without the size. We now also print the size. Issue 994
This commit is contained in:
@@ -466,12 +466,12 @@ struct object_stringize_visitor {
|
||||
m_os << '"';
|
||||
return true;
|
||||
}
|
||||
bool visit_bin(const char* v, uint32_t size) {
|
||||
(m_os << '"').write(v, static_cast<std::streamsize>(size)) << '"';
|
||||
bool visit_bin(const char* /*v*/, uint32_t size) {
|
||||
m_os << "BIN(" << size << ")";
|
||||
return true;
|
||||
}
|
||||
bool visit_ext(const char* /*v*/, uint32_t /*size*/) {
|
||||
m_os << "EXT";
|
||||
bool visit_ext(const char* /*v*/, uint32_t size) {
|
||||
m_os << "EXT(" << size << ")";
|
||||
return true;
|
||||
}
|
||||
bool start_array(uint32_t num_elements) {
|
||||
|
Reference in New Issue
Block a user