void carray2Hex(const unsigned char *d, uint64_t _len, char *_hexArray,
                uint64_t _hexArrayLen) {

    CHECK_STATE(d);
    CHECK_STATE(_hexArray);

    char hexval[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
                       '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};

    CHECK_STATE(_hexArrayLen > 2 * _len);

    for (int j = 0; j < _len; j++) {
        _hexArray[j * 2] = hexval[((d[j] >> 4) & 0xF)];
        _hexArray[j * 2 + 1] = hexval[(d[j]) & 0x0F];
    }

    _hexArray[_len * 2] = 0;
}
The software writes data past the end, or before the beginning, of the intended buffer.