summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-12-09 00:07:23 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-12-09 00:07:23 +0000
commit776ca0830a9a044d37741e1773af0c8ffeb50dbf (patch)
treeada2d75646944205d3f269beb15b16acbf52f231
parentd6c9018a02b7fa383ea2e380bec7dca60b93d15c (diff)
parent58f5cfa56d5282e69a7580dc4bb97603c409f003 (diff)
downloadnative-776ca0830a9a044d37741e1773af0c8ffeb50dbf.tar.gz
libbinder: check null bytes in readString*Inplace am: 58f5cfa56d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/13144867 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Iba13c2f0f45b6cce292e8b579353ad66d425fa79
-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 d5d7435252..7065b707b9 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1881,7 +1881,7 @@ const char* Parcel::readString8Inplace(size_t* outLen) const
if (size >= 0 && size < INT32_MAX) {
*outLen = size;
const char* str = (const char*)readInplace(size+1);
- if (str != nullptr) {
+ if (str != nullptr && str[size] == '\0') {
return str;
}
}
@@ -1941,7 +1941,7 @@ const char16_t* Parcel::readString16Inplace(size_t* outLen) const
if (size >= 0 && size < INT32_MAX) {
*outLen = size;
const char16_t* str = (const char16_t*)readInplace((size+1)*sizeof(char16_t));
- if (str != nullptr) {
+ if (str != nullptr && str[size] == u'\0') {
return str;
}
}