diff options
author | Sergio Giro <sgiro@google.com> | 2015-08-20 22:44:57 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-20 22:44:57 +0000 |
commit | e97682be0634fe773f70097bc518e5d034efe8f7 (patch) | |
tree | 0d8322597dadb6b479883d3e8b815ab7ea62e89a /libutils/String8.cpp | |
parent | 1def25a210ca502a97020efb732775d5c2df2d9a (diff) | |
parent | a1a22b5736d5ad71531fd07d5c4103585e8e8977 (diff) |
am a1a22b57: am e67b5848: am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit 'a1a22b5736d5ad71531fd07d5c4103585e8e8977':
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 9092cbc99..574165386 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) { |