void create_test_key() {
    int errStatus = 0;
    vector<char> errMsg(1024, 0);
    uint32_t enc_len;

    SAFE_UINT8_BUF(encrypted_key, BUF_LEN);

    string key = TEST_VALUE;

    sgx_status_t status = trustedEncryptKeyAES(eid, &errStatus, errMsg.data(), key.c_str(), encrypted_key, &enc_len);

    HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data());

    vector<char> hexEncrKey(2 * enc_len + 1, 0);

    carray2Hex(encrypted_key, enc_len, hexEncrKey.data(), 2 * enc_len + 1);

    LevelDB::getLevelDb()->writeDataUnique("TEST_KEY", hexEncrKey.data());
}
The software writes data past the end, or before the beginning, of the intended buffer.