summaryrefslogtreecommitdiff
path: root/libutils/String16.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-07-14 16:45:16 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-14 16:45:16 +0000
commit26b81f59d2e340d950faac120daedf47364c7e33 (patch)
tree513429ea83e70d9bf34982f2f30fd74c8edad034 /libutils/String16.cpp
parent6ea9b8b580f56ddac47dca63e8c94e23eb2edcb4 (diff)
parent4e27b6992b696d72a81f62178d2be44797ef377a (diff)
String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0 am: 64fb5012b8 am: 4e27b6992b
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802 Change-Id: Id47901d6e4247aafb9f666ba505ab966d3adefed
Diffstat (limited to 'libutils/String16.cpp')
-rw-r--r--libutils/String16.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libutils/String16.cpp b/libutils/String16.cpp
index 818b17124..caab1bd99 100644
--- a/libutils/String16.cpp
+++ b/libutils/String16.cpp
@@ -389,7 +389,7 @@ status_t String16::remove(size_t len, size_t begin)
mString = getEmptyString();
return OK;
}
- if ((begin+len) > N) len = N-begin;
+ if (len > N || len > N - begin) len = N - begin;
if (begin == 0 && len == N) {
return OK;
}