Skip to content

Commit

Permalink
Merge pull request #25 from dnmiller/underflow-fix
Browse files Browse the repository at this point in the history
Remove possible underflow in string buffer encoder
  • Loading branch information
sapek committed Jan 31, 2015
2 parents 1af198f + 4ab240d commit 80b1e15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/inc/bond/protocol/encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ inline ReadStringData(Buffer& input, T& value, uint32_t length)
resize_string(value, length);
typename element_type<T>::type* data = string_data(value);
typename string_char_int_type<T>::type ch;
for (int i = 0; i < length; ++i)
for (uint32_t i = 0; i < length; ++i)
{
input.Read(ch);
data[i] = static_cast<typename element_type<T>::type>(ch);
Expand All @@ -219,7 +219,7 @@ inline WriteStringData(Buffer& output, const T& value, uint32_t length)
{
const typename element_type<T>::type* data = string_data(value);
typename string_char_int_type<T>::type ch;
for (int i = 0; i < length; ++i)
for (uint32_t i = 0; i < length; ++i)
{
ch = static_cast<typename string_char_int_type<T>::type>(data[i]);
output.Write(ch);
Expand Down

0 comments on commit 80b1e15

Please sign in to comment.