Android: Heap-overflow in "tlc_server" via LOAD_TUI_RESOURCE command As a part of the TrustZone framework available on Samsung devices, Samsung provides an Android daemon which enables communication with a selected set of trustlets running in the Secure World. The daemon is spawned multiple time, once for each supported trustlet. It then registers an Android binder service with a name corresponding to the trustlet with which it may communicate. Apart from the regular commands which enable communication with the trustlet itself, the daemon also provides a special command called LOAD_TUI_RESOURCE (command code 5) which enables loading a KNOX TUI (Trusted User Interface) resource. The function handling this command has the following logic: Parcel data = ...; ... if (data.readInt32(&numDwords)) goto error; uint32_t* buffer = (uint32_t*)malloc(numDwords * 4); if (!buffer) goto error; for (uint32_t i=0; i