summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Giro <sgiro@google.com>2015-08-20 22:38:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-20 22:38:33 +0000
commita1a22b5736d5ad71531fd07d5c4103585e8e8977 (patch)
treec47454ba153d4724a5882a311685998f500b7401
parent7ac6068636b0f43091a11064c212d7741f8e9cb5 (diff)
parente67b584869eea8d4e955e82de1e38ede080a2ed4 (diff)
downloadcore-a1a22b5736d5ad71531fd07d5c4103585e8e8977.tar.gz
am e67b5848: am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit 'e67b584869eea8d4e955e82de1e38ede080a2ed4': libutils: fix overflow in String8::allocFromUTF8
-rw-r--r--libutils/String8.cpp3
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) {