summaryrefslogtreecommitdiff
path: root/libutils/String16.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-07-14 16:12:53 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-14 16:12:53 +0000
commit64fb5012b8290b30f177b876a915b0c7acd65ea9 (patch)
tree72ca3f467ed2fc5a29eb298a43e338f47ab3c0d0 /libutils/String16.cpp
parentf7724dfcfb2af2ee2c50e116c8a1784b0eceab21 (diff)
parent9be245c3f0317869606eb2656162d7798eb254fd (diff)
String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802 Change-Id: I3ab9771d898eea0158acfd07fbe5a2f4b7dad883
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 e8f1c5184..7055fc6c3 100644
--- a/libutils/String16.cpp
+++ b/libutils/String16.cpp
@@ -402,7 +402,7 @@ status_t String16::remove(size_t len, size_t begin)
mString = getEmptyString();
return NO_ERROR;
}
- if ((begin+len) > N) len = N-begin;
+ if (len > N || len > N - begin) len = N - begin;
if (begin == 0 && len == N) {
return NO_ERROR;
}