aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/string.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-10-10 13:27:00 +0000
committerDamjan Marion <dmarion@me.com>2018-10-10 16:03:40 +0000
commit825fc4892ee7ec3cff83b2754cd921c0157e62f8 (patch)
treed3a46d299253c6dbb24cb07d8d53f45e9e36ef69 /src/vppinfra/string.h
parentb9fa29d513bfad0d9f18e8ed8c2da3feaa6d3bf0 (diff)
Integer underflow and out-of-bounds read (VPP-1442)
Change-Id: Ife2a83b9d7f733f36e0e786ef79edcd394d7c0f9 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vppinfra/string.h')
-rw-r--r--src/vppinfra/string.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h
index 8f165dfa18e..2c794baf71f 100644
--- a/src/vppinfra/string.h
+++ b/src/vppinfra/string.h
@@ -356,7 +356,7 @@ clib_count_equal_u64 (u64 * data, uword max_count)
#endif
count += 2;
data += 2;
- while (count < max_count - 3 &&
+ while (count + 3 < max_count &&
((data[0] ^ first) | (data[1] ^ first) |
(data[2] ^ first) | (data[3] ^ first)) == 0)
{
@@ -424,7 +424,7 @@ clib_count_equal_u32 (u32 * data, uword max_count)
#endif
count += 2;
data += 2;
- while (count < max_count - 3 &&
+ while (count + 3 < max_count &&
((data[0] ^ first) | (data[1] ^ first) |
(data[2] ^ first) | (data[3] ^ first)) == 0)
{
@@ -492,7 +492,7 @@ clib_count_equal_u16 (u16 * data, uword max_count)
#endif
count += 2;
data += 2;
- while (count < max_count - 3 &&
+ while (count + 3 < max_count &&
((data[0] ^ first) | (data[1] ^ first) |
(data[2] ^ first) | (data[3] ^ first)) == 0)
{
@@ -560,7 +560,7 @@ clib_count_equal_u8 (u8 * data, uword max_count)
#endif
count += 2;
data += 2;
- while (count < max_count - 3 &&
+ while (count + 3 < max_count &&
((data[0] ^ first) | (data[1] ^ first) |
(data[2] ^ first) | (data[3] ^ first)) == 0)
{