diff options
author | Sergio Giro | 2015-08-18 12:19:10 -0500 |
---|---|---|
committer | Android Git Automerger | 2015-08-18 12:19:10 -0500 |
commit | ba71601aacb3846d7c83cfc89fff689e1b774c54 (patch) | |
tree | f49ba9db4447777b801a2620fb40ad42229502ce | |
parent | 8e9a1ae5936d2bfae23dc0f7414a68973a894209 (diff) | |
parent | 29c1275519ef85fa3f30be351f19dc6e7eedbee9 (diff) | |
download | platform-system-core-ba71601aacb3846d7c83cfc89fff689e1b774c54.tar.gz platform-system-core-ba71601aacb3846d7c83cfc89fff689e1b774c54.tar.xz platform-system-core-ba71601aacb3846d7c83cfc89fff689e1b774c54.zip |
am 29c12755: Merge "libutils: fix overflow in String8::allocFromUTF8" into mnc-dev
* commit '29c1275519ef85fa3f30be351f19dc6e7eedbee9':
libutils: fix overflow in String8::allocFromUTF8
-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 28be60fb5..69313ead7 100644 --- a/libutils/String8.cpp +++ b/libutils/String8.cpp | |||
@@ -79,6 +79,9 @@ void terminate_string8() | |||
79 | static char* allocFromUTF8(const char* in, size_t len) | 79 | static char* allocFromUTF8(const char* in, size_t len) |
80 | { | 80 | { |
81 | if (len > 0) { | 81 | if (len > 0) { |
82 | if (len == SIZE_MAX) { | ||
83 | return NULL; | ||
84 | } | ||
82 | SharedBuffer* buf = SharedBuffer::alloc(len+1); | 85 | SharedBuffer* buf = SharedBuffer::alloc(len+1); |
83 | ALOG_ASSERT(buf, "Unable to allocate shared buffer"); | 86 | ALOG_ASSERT(buf, "Unable to allocate shared buffer"); |
84 | if (buf) { | 87 | if (buf) { |