commit | 503871ad4741169dc6dd04202cdb753c67f95a9f | [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 | af9f96d5e683e3b72b794d5284811e85324d8253 [diff] | |
parent | 1389599ae38fd7c5685b33ba9238b29269a54df6 [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) {