File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ Boost::ASIO low-level redis client (connector)
1919
2020## Changelog
2121
22+ ### 0.09
23+ - [ bugfix] critical bug in protcol serialization on empty values
24+
2225### 0.08
2326- relaxed c++ compiler requirements: c++11 can be used instead of c++14
2427
764767- [ Vinnie Falco] ( https://github.com/vinniefalco )
765768- [ Stephen Coleman] ( https://github.com/omegacoleman )
766769- [ maxtorm miximtor] ( https://github.com/miximtor )
770+ - [ Ronny Nowak] ( https://github.com/dargun )
767771
768772## See also
769773- https://github.com/Cylix/cpp_redis
Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ inline std::size_t size_for_int(std::size_t arg) {
442442 ++r;
443443 arg /= 10 ;
444444 }
445- return r;
445+ return std::max< size_t >( 1 , r); /* if r == 0 we clamp max to 1 to allow minimum containing "0" as char */
446446}
447447
448448inline std::size_t command_size (const single_command_t &cmd) {
@@ -477,9 +477,11 @@ inline void Protocol::serialize(DynamicBuffer &buff,
477477 it += bytes;
478478 total += bytes;
479479
480- buffer_copy (it, buffer (arg.data (), arg.size ()));
481- it += arg.size ();
482- total += arg.size ();
480+ if (!arg.empty ()) {
481+ buffer_copy (it, buffer (arg.data (), arg.size ()));
482+ it += arg.size ();
483+ total += arg.size ();
484+ }
483485
484486 buffer_copy (it, buffer (" \r\n " , terminator.size ));
485487 total += terminator.size ;
You can’t perform that action at this time.
0 commit comments