diff options
author | Bill Meier <wmeier@newsguy.com> | 2015-02-07 16:23:12 -0500 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2015-02-07 21:33:35 +0000 |
commit | 96527e24e8e10a707c51c48f52233453c3056702 (patch) | |
tree | 59aff977195faa051d256c3538c72523053d0b18 | |
parent | 22b461943e461dacee4ef7d2e2f0706d35d2006c (diff) |
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>
-rw-r--r-- | epan/dissectors/packet-riemann.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-riemann.c b/epan/dissectors/packet-riemann.c index c4e0d94e4f..96c69e626c 100644 --- a/epan/dissectors/packet-riemann.c +++ b/epan/dissectors/packet-riemann.c @@ -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) { |