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
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 9642a87..1f7d27e 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1869,7 +1869,7 @@
     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 @@
     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;
         }
     }