commit | 1d44be87ffdc5e3bc074ab68200bff9d32c60d3a | [log] [tgz] |
---|---|---|
author | Sergio Giro <sgiro@google.com> | Tue Aug 18 17:04:07 2015 +0000 |
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | Tue Aug 18 17:04:07 2015 +0000 |
tree | 88887dc0eec1d946f0af26229afe723d4db72379 | |
parent | 4d09db9d1a4139933cdb0ac9b5bcdebf8cc528eb [diff] | |
parent | 4eeacbeec0ae66e9d9395abbf83666709f2e11e3 [diff] |
Merge "libutils: fix overflow in String8::allocFromUTF8"
diff --git a/libutils/String8.cpp b/libutils/String8.cpp index 28be60f..69313ea 100644 --- a/libutils/String8.cpp +++ b/libutils/String8.cpp
@@ -79,6 +79,9 @@ 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) {