Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove possible underflow in string buffer encoder #25

Merged
merged 1 commit into from
Jan 31, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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