summaryrefslogtreecommitdiff
path: root/libutils/String8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libutils/String8.cpp')
-rw-r--r--libutils/String8.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libutils/String8.cpp b/libutils/String8.cpp
index fad130b1b..4d242a7a3 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -313,8 +313,8 @@ status_t String8::appendFormatV(const char* fmt, va_list args)
if (n > 0) {
size_t oldLength = length();
- if ((size_t)n > SIZE_MAX - 1 ||
- oldLength > SIZE_MAX - (size_t)n - 1) {
+ if (n > std::numeric_limits<size_t>::max() - 1 ||
+ oldLength > std::numeric_limits<size_t>::max() - n - 1) {
return NO_MEMORY;
}
char* buf = lockBuffer(oldLength + n);