diff options
| author | 2019-06-05 01:50:18 +0000 | |
|---|---|---|
| committer | 2019-06-05 01:50:18 +0000 | |
| commit | 85c1e41520b430bc0cfd6ee8dc0ee289144beb95 (patch) | |
| tree | 5cfd518ee8b697cd67806b27ec62c7d9da44ae34 | |
| parent | e67d59255e5aab7ca1ea4a2893c2ab88d0b70d15 (diff) | |
| parent | 2537a8b5b6ab9e8908ddc27178e88bf80d9dfc10 (diff) | |
[automerger] libbinder: readCString: no ubsan sub-overflow am: d0d4b584fc am: a7134ad559 am: 7e71b6ee21 am: 2537a8b5b6
Change-Id: I523c3ab2eb0a2479fee7e4ea33ece5da88f73bd5
| -rw-r--r-- | libs/binder/Parcel.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index e5a34c225d..e9c26ea9ad 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -1907,8 +1907,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)); |