diff options
author | Matthew Maurer <mmaurer@google.com> | 2019-04-09 17:10:48 -0700 |
---|---|---|
committer | Matthew Maurer <mmaurer@google.com> | 2019-04-09 17:11:34 -0700 |
commit | 92525f7ea55040a004869b76baeca02a39268363 (patch) | |
tree | a750fa49832b7a177548d37622e4dbe1fb77d11c | |
parent | 27748e24c1a1fbfb2919817333b6270ace62c16c (diff) | |
download | gatekeeper-92525f7ea55040a004869b76baeca02a39268363.tar.gz |
Minor change to be clean on integer sanitizationandroid-o-mr1-iot-release-1.0.12oreo-mr1-iot-release
The idiom `while(x--) {` will decrement x through 0, triggering the
overflow sanitizer. Using for(; x > 0; x--) is equivalent if the
variable is not used afterwards.
Bug: 129300035
Change-Id: I5c32d0a401b4cb1acdbfebf5654e6901822fc72c
-rw-r--r-- | include/gatekeeper/gatekeeper_utils.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/gatekeeper/gatekeeper_utils.h b/include/gatekeeper/gatekeeper_utils.h index 8ee032b..f6e35e2 100644 --- a/include/gatekeeper/gatekeeper_utils.h +++ b/include/gatekeeper/gatekeeper_utils.h @@ -48,7 +48,7 @@ static inline int memcmp_s(const void* p1, const void* p2, size_t length) { const uint8_t* s1 = static_cast<const uint8_t*>(p1); const uint8_t* s2 = static_cast<const uint8_t*>(p2); uint8_t result = 0; - while (length-- > 0) + for (; length > 0; length--) result |= *s1++ ^ *s2++; return result == 0 ? 0 : 1; } |