From 153349203f005c73a052b6130090b49c197f3d67 Mon Sep 17 00:00:00 2001 From: Lisandre Taylor <7604725+Litome@users.noreply.github.com> Date: Fri, 18 Mar 2022 02:56:27 +0000 Subject: [PATCH] [Android] Fix CHIPTool cluster cmds fail or app crashes (Issue #15637). (#15919) * [Android] Fix CHIPTool cluster cmds fail or app crashes (Issue #15637). * [Android] Fix expression in verification instead of commenting out the verification. * Restyled by clang-format * [Android] Fix merge issue and revert un-necessary changes to verification expression Co-authored-by: Lisandre Taylor Co-authored-by: Restyled.io --- src/platform/android/DnssdImpl.cpp | 2 +- src/platform/android/KeyValueStoreManagerImpl.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/android/DnssdImpl.cpp b/src/platform/android/DnssdImpl.cpp index 52d20525e8ca04..fa5a9d30e589f2 100644 --- a/src/platform/android/DnssdImpl.cpp +++ b/src/platform/android/DnssdImpl.cpp @@ -44,7 +44,7 @@ jmethodID sPublishMethod = nullptr; jmethodID sRemoveServicesMethod = nullptr; } // namespace -// Implemention of functions declared in lib/dnssd/platform/Dnssd.h +// Implementation of functions declared in lib/dnssd/platform/Dnssd.h CHIP_ERROR ChipDnssdInit(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context) { diff --git a/src/platform/android/KeyValueStoreManagerImpl.cpp b/src/platform/android/KeyValueStoreManagerImpl.cpp index 46ba0354f915cb..3b15d888810e56 100644 --- a/src/platform/android/KeyValueStoreManagerImpl.cpp +++ b/src/platform/android/KeyValueStoreManagerImpl.cpp @@ -120,7 +120,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t ChipLogError(DeviceLayer, "KeyValueStoreManager base64 decoding failed"); return CHIP_ERROR_INTEGRITY_CHECK_FAILED; } - ReturnErrorCodeIf(offset_bytes >= decodedLength, CHIP_ERROR_INVALID_ARGUMENT); + ReturnErrorCodeIf(offset_bytes != 0 && offset_bytes >= decodedLength, CHIP_ERROR_INVALID_ARGUMENT); size_t read_size = std::min(value_size, decodedLength - offset_bytes); if (value_size + offset_bytes < decodedLength) {