riemann: Fix bug found by MSVC203 Code Analysis

The following doesn't quite do what it might seem to be doing:
    guint64 num;
    guint8 b;
    num |= ((b & 0x7f) << shift);

The warning from MSVC2013:
 Arithmetic overflow:  32-bit value is shifted, then cast to 64-bit
  value. Results might not be an expected value

Change-Id: Ic8c939355b54317f0b459c60342f3cb5dfa29624
Reviewed-on: https://code.wireshark.org/review/7015
Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
Bill Meier 2015-02-07 16:23:12 -05:00
parent 22b461943e
commit 96527e24e8
1 changed files with 1 additions and 1 deletions

View File

@ -223,7 +223,7 @@ riemann_get_guint64(tvbuff_t *tvb, guint offset, guint *len)
return 0;
}
b = tvb_get_guint8(tvb, offset++);
num |= ((b & 0x7f) << shift);
num |= ((guint64)(b & 0x7f) << shift);
shift += 7;
(*len)++;
if ((b & 0x80) == 0) {