summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Giro2015-08-20 17:58:19 -0500
committerAndroid Git Automerger2015-08-20 17:58:19 -0500
commit93f106b8d0207ce685ad56704df8a568f3edebb6 (patch)
tree9e49719e942355ecb6a1e46e73d4a291ce4edf19 /libutils/String8.cpp
parent87b02f23c0996ab487ef15794bf862b3cd3e5137 (diff)
parente97682be0634fe773f70097bc518e5d034efe8f7 (diff)
downloadplatform-system-core-93f106b8d0207ce685ad56704df8a568f3edebb6.tar.gz
platform-system-core-93f106b8d0207ce685ad56704df8a568f3edebb6.tar.xz
platform-system-core-93f106b8d0207ce685ad56704df8a568f3edebb6.zip
am e97682be: am a1a22b57: am e67b5848: am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit 'e97682be0634fe773f70097bc518e5d034efe8f7': libutils: fix overflow in String8::allocFromUTF8
Diffstat (limited to 'libutils/String8.cpp')
-rw-r--r--libutils/String8.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libutils/String8.cpp b/libutils/String8.cpp
index 3323b82a5..149660231 100644
--- a/libutils/String8.cpp
+++ b/libutils/String8.cpp
@@ -78,6 +78,9 @@ void terminate_string8()
78static char* allocFromUTF8(const char* in, size_t len) 78static char* allocFromUTF8(const char* in, size_t len)
79{ 79{
80 if (len > 0) { 80 if (len > 0) {
81 if (len == SIZE_MAX) {
82 return NULL;
83 }
81 SharedBuffer* buf = SharedBuffer::alloc(len+1); 84 SharedBuffer* buf = SharedBuffer::alloc(len+1);
82 ALOG_ASSERT(buf, "Unable to allocate shared buffer"); 85 ALOG_ASSERT(buf, "Unable to allocate shared buffer");
83 if (buf) { 86 if (buf) {