summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2019-05-17 13:11:30 -0700
committerNikoli Cartagena <dargeren@google.com>2019-06-10 15:55:27 -0700
commit3b82196284ea11b8374bfea6afb027617043d6e6 (patch)
tree4b2e0e7e05b8d73f2fcf2725a3f734c28bdc82f0
parentc15730496d9d412871dc3a9b11524e49f3f222b0 (diff)
downloadplatform_system_libhwbinder-security-pi-release.tar.gz
platform_system_libhwbinder-security-pi-release.tar.bz2
platform_system_libhwbinder-security-pi-release.zip
Bug: 132650049 Test: fuzzer Change-Id: I1f6dcad6906951ab505a7500573b74b210a68705 Merged-In: I1f6dcad6906951ab505a7500573b74b210a68705 (cherry picked from commit 1086548c6ceb141e2852d2690db8386911a014dd)
-rw-r--r--Parcel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Parcel.cpp b/Parcel.cpp
index 6e9bd1e..096913f 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -1332,8 +1332,8 @@ bool Parcel::readBool() const
const char* Parcel::readCString() const
{
- const size_t avail = mDataSize-mDataPos;
- if (avail > 0) {
+ if (mDataPos < mDataSize) {
+ const size_t avail = mDataSize-mDataPos;
const char* str = reinterpret_cast<const char*>(mData+mDataPos);
// is the string's trailing NUL within the parcel's valid bounds?
const char* eos = reinterpret_cast<const char*>(memchr(str, 0, avail));