bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *encryptedKeyHex) {

    CHECK_STATE(s_shares);
    CHECK_STATE(encryptedKeyHex);

    vector<char> errMsg(BUF_LEN,0);
    int errStatus = 0;

    uint64_t decKeyLen;
    SAFE_UINT8_BUF(encr_bls_key,BUF_LEN);
    SAFE_UINT8_BUF(encr_key,BUF_LEN);
    if (!hex2carray(encryptedKeyHex, &decKeyLen, encr_key, BUF_LEN)) {
        throw SGXException(INVALID_HEX, "Invalid encryptedKeyHex");
    }

    uint32_t enc_bls_len = 0;

    sgx_status_t status = trustedCreateBlsKeyAES(eid, &errStatus, errMsg.data(), s_shares, encr_key, decKeyLen, encr_bls_key,
                                                 &enc_bls_len);

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

    SAFE_CHAR_BUF(hexBLSKey,2 * BUF_LEN)

    carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey, 2 * BUF_LEN);

    SGXWalletServer::writeDataToDB(blsKeyName, hexBLSKey);

    return true;

}
The software writes data past the end, or before the beginning, of the intended buffer.