summaryrefslogtreecommitdiff
path: root/libs/binder/Parcel.cpp
diff options
context:
space:
mode:
author android-build-team Robot <android-build-team-robot@google.com> 2019-08-13 16:32:13 +0000
committer android-build-team Robot <android-build-team-robot@google.com> 2019-08-13 16:32:13 +0000
commit40b476c5790168a9bad2d7b5459883c07d25cc35 (patch)
treedb909ff3f2f9144efdcda103e236aa0a49d21faa /libs/binder/Parcel.cpp
parent6431a9bc8f0243205fa09fa316f84bdfe13858c4 (diff)
parent10308535f891cc57e1cffba1f67266f183a2b579 (diff)
Snap for 5674421 from 10308535f891cc57e1cffba1f67266f183a2b579 to pi-platform-release
Change-Id: Icda4c77b242286024e054f58ee28ecb0974e482e
Diffstat (limited to 'libs/binder/Parcel.cpp')
-rw-r--r--libs/binder/Parcel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 2e7edd7a28..8e206f501f 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -2013,8 +2013,8 @@ status_t Parcel::readUtf8FromUtf16(std::unique_ptr<std::string>* str) 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));