summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-12-09 00:08:09 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-12-09 00:08:09 +0000
commitabe42c95f650e8bf9dbb034263a8fcee9c0aaf46 (patch)
tree4717ace370be83e337c26e372cf798aeeac2b252
parent49db501563baddadaf1ed93c86abd65f242d5411 (diff)
parent58f5cfa56d5282e69a7580dc4bb97603c409f003 (diff)
downloadnative-abe42c95f650e8bf9dbb034263a8fcee9c0aaf46.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: I38ad7b4e9721041dd2dd8f791030bfc0d40b8670
-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 9642a87f4e..1f7d27e0e9 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1869,7 +1869,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;
}
}
@@ -1929,7 +1929,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;
}
}