diff options
author | Steven Moreland <smoreland@google.com> | 2020-07-14 16:29:09 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-07-14 16:29:09 +0000 |
commit | 4e27b6992b696d72a81f62178d2be44797ef377a (patch) | |
tree | 8237c8875434ce0497c2ad05f9513a382aa6fcb0 | |
parent | 75b3266e22fdcf8ae73607b8346d1f156cea28ce (diff) | |
parent | 64fb5012b8290b30f177b876a915b0c7acd65ea9 (diff) | |
download | core-4e27b6992b696d72a81f62178d2be44797ef377a.tar.gz |
String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0 am: 64fb5012b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802
Change-Id: I03057c052a24f205c78ee600178d45e0cd51a3c1
-rw-r--r-- | libutils/String16.cpp | 2 |
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; } |