Skip to content

Commit

Permalink
Merge pull request #38 from Dargun/issue-37
Browse files Browse the repository at this point in the history
  • Loading branch information
basiliscos authored Dec 7, 2019
2 parents 531f741 + 9df81db commit 7ab27ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Boost::ASIO low-level redis client (connector)

## Changelog

### 0.09
- [bugfix] critical bug in protcol serialization on empty values

### 0.08
- relaxed c++ compiler requirements: c++11 can be used instead of c++14

Expand Down Expand Up @@ -764,6 +767,7 @@ MIT
- [Vinnie Falco](https://github.com/vinniefalco)
- [Stephen Coleman](https://github.com/omegacoleman)
- [maxtorm miximtor](https://github.com/miximtor)
- [Ronny Nowak](https://github.com/dargun)

## See also
- https://github.com/Cylix/cpp_redis
Expand Down
10 changes: 6 additions & 4 deletions include/bredis/impl/protocol.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ inline std::size_t size_for_int(std::size_t arg) {
++r;
arg /= 10;
}
return r;
return std::max<size_t>(1, r); /* if r == 0 we clamp max to 1 to allow minimum containing "0" as char */
}

inline std::size_t command_size(const single_command_t &cmd) {
Expand Down Expand Up @@ -477,9 +477,11 @@ inline void Protocol::serialize(DynamicBuffer &buff,
it += bytes;
total += bytes;

buffer_copy(it, buffer(arg.data(), arg.size()));
it += arg.size();
total += arg.size();
if(!arg.empty()) {
buffer_copy(it, buffer(arg.data(), arg.size()));
it += arg.size();
total += arg.size();
}

buffer_copy(it, buffer("\r\n", terminator.size));
total += terminator.size;
Expand Down

0 comments on commit 7ab27ed

Please sign in to comment.