Replace variable-length arrays on stack with malloc.

Bug: 30202619
Change-Id: Ib95e08a1c009d88a4b4fd8d8fdba0641c6129008
(cherry picked from commit 943905bb9f99e3caa856b42c531e2be752da8834)

void log_hex(const char *who, const uint8_t *buffer, int length) {
 char out[80];
 int source = 0;
 int dest = 0;
 int dest_len = sizeof(out);
 int per_line = 0;

 do {
        dest += sprintf(out, "%8.8s [%8.8x] ", who, source);
 for(; source < length && dest_len - dest > 3 && per_line < BYTES_PER_LINE; source++,
        per_line ++) {
            out[dest++] = HEX_HIGH(buffer[source]);
            out[dest++] = HEX_LOW(buffer[source]);
            out[dest++] = ' ';
 }
 if (dest < dest_len && (per_line == BYTES_PER_LINE || source >= length)) {
            out[dest++] = 0;
            per_line = 0;
            dest = 0;
            RLOGD("%s\n", out);
 }
 } while(source < length && dest < dest_len);
}

void log_hex(const char *who, const uint8_t *buffer, int length) {
 char out[80];
 int source = 0;
 int dest = 0;
 int dest_len = sizeof(out);
 int per_line = 0;

 do {
        dest += sprintf(out, "%8.8s [%8.8x] ", who, source);
 for(; source < length && dest_len - dest > 3 && per_line < BYTES_PER_LINE; source++,
        per_line ++) {
            out[dest++] = HEX_HIGH(buffer[source]);
            out[dest++] = HEX_LOW(buffer[source]);
            out[dest++] = ' ';
 }
 if (dest < dest_len && (per_line == BYTES_PER_LINE || source >= length)) {
            out[dest++] = 0;
            per_line = 0;
            dest = 0;
            RLOGD("%s\n", out);
 }
 } while(source < length && dest < dest_len);
}
