diff options
author | Sergio Giro <sgiro@google.com> | 2015-08-20 22:23:47 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-20 22:23:47 +0000 |
commit | 4956c0fe1e582a8497aff34a41aeb8bf4748eef0 (patch) | |
tree | 6d0fe134e6914d96b7f29e498eabacee781595c4 /libutils/String8.cpp | |
parent | e8582d65ea03a91b5cdc2c374ec9a420f809138f (diff) | |
parent | 5b85b1d40d619c2064d321364f212ebfeb6ba185 (diff) |
am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit '5b85b1d40d619c2064d321364f212ebfeb6ba185':
libutils: fix overflow in String8::allocFromUTF8
Diffstat (limited to 'libutils/String8.cpp')
-rw-r--r-- | libutils/String8.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libutils/String8.cpp b/libutils/String8.cpp index e852d77b7..e5a48e55a 100644 --- a/libutils/String8.cpp +++ b/libutils/String8.cpp @@ -78,6 +78,9 @@ void terminate_string8() static char* allocFromUTF8(const char* in, size_t len) { if (len > 0) { + if (len == SIZE_MAX) { + return NULL; + } SharedBuffer* buf = SharedBuffer::alloc(len+1); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { |