diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-04-26 18:10:13 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-04-26 18:10:13 +0100 |
commit | 11dbf2aab3e9a65148a40ac6b5b1124929344c1a (patch) | |
tree | 6550798794f5df40bcd86cd151efcc2027b0cca3 /src/message.cpp | |
parent | 9b010290a49243e5867dd9d4c93784a345fb2637 (diff) |
Fix a bunch of compiler warnings, and turn on warnings.
Diffstat (limited to 'src/message.cpp')
-rw-r--r-- | src/message.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/message.cpp b/src/message.cpp index 30abd9c..23ec823 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -136,7 +136,7 @@ static std::uint8_t const * decode( std::uint8_t const * len_start = pos; pos = varint_skip(pos, end); std::size_t len = varint_decode<std::size_t>(len_start, pos); - if (len > end - pos) return end; + if (len + pos > end) return end; value = pos; value_length = len; pos += len; @@ -157,7 +157,7 @@ static std::uint8_t const * skip_unknown( std::uint8_t const * len_start = pos; pos = varint_skip(pos, end); std::size_t len = varint_decode<std::size_t>(len_start, pos); - if (len > end - pos) return end; + if (len + pos > end) return end; pos += len; } else { return end; |