diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-08-07 18:25:21 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-08-07 18:25:21 +0100 |
commit | 76ecd85c2cf4b9b1fb2350774d24860537d1d571 (patch) | |
tree | f69ce39f7785996eea8f8140db6b624b84c3fea7 /src/message.cpp | |
parent | 41a8fb61afacc57e6da2e2cb427ecdf889dcabdf (diff) |
Fix a crash when decoding messages that are too short
Diffstat (limited to 'src/message.cpp')
-rw-r--r-- | src/message.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/message.cpp b/src/message.cpp index 93473b9..8e807fd 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -49,6 +49,9 @@ T varint_decode( std::uint8_t const * varint_end ) { T value = 0; + if (varint_end == varint_start) { + return 0; + } do { value <<= 7; value |= 0x7F & *(--varint_end); |