std::length_error in corrispondenza della posizione di memoria 0x00AAE668

Viewed 47

i made a login that get the response from my server and try to parse with jsoncpp but i get this error: std::length_error in corrispondenza della posizione di memoria 0x00AAE668. at "if (jsonReader.parse(*httpData.get(), jsonData))".

Trying to debug the response is correct, the json is correct but the parse get an error.

The code for the login is:

static Json::Value jsonData;





std::string hwid()
{
ATL::CAccessToken accessToken;
ATL::CSid currentUserSid;
if (accessToken.GetProcessToken(TOKEN_READ | TOKEN_QUERY) &&
    accessToken.GetUser(&currentUserSid))
    return std::string(CT2A(currentUserSid.Sid()));
}
std::string login(const char user[], const char pass[])
{
std::string pass_hashed = base64_encode(pass);

const std::string url("https://example.com/api.php?key=148H1329F2H982&user=" + std::string(user) + "&pass=" + pass_hashed + "&hwid=" + hwid() + "&owner=0&admin=0");

CURL* curl = curl_easy_init();

curl_easy_setopt(curl, CURLOPT_URL, url.c_str());

curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);

curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);

curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);


long httpCode(0);
std::unique_ptr<std::string> httpData(new std::string());


curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, callback);

curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());

curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);

if (httpCode == 200)
{

    std::cout << *httpData.get();
    Json::Reader jsonReader;

    if (jsonReader.parse(*httpData.get(), jsonData)) <-- here the error occurs
    {
        if (jsonData["status"] == "failed")
        {
            return "Failed";
        }
        if (jsonData["status"] == "success")
        {
            return "Success";
        }
    }
    else
    {
        MessageBox(NULL, L"Unable to login. This could be caused by: \n\nNo Internet\nFirewall blocking\nProblem with server side.", L"Error", 0);
        return "Failed1";
    }
}
else
{

}





}

The api response is like this:

{"status":"success","uid":"5","username":"ItaHacker","hwid":"S-1-5-21-1852407829-3852139131-3356130716-1001","admin":"1","banned":"0","invitedBy":"cloudyfaith","createdAt":"2021-10-01 20:10:09","script":true,"scriptsub":"2022-12-27","spoofer":false,"rustcheat":false,"apex":false,"vision-csgo":false,"vision-cheat":false,"vision-script":false}
0 Answers
Related