Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash after cs_set_user_model is used with model_index parameter set. #370

Merged
merged 1 commit into from Apr 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/cstrike/cstrike/CstrikeNatives.cpp
Expand Up @@ -897,16 +897,16 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params)

GET_OFFSET("CBasePlayer", m_modelIndexPlayer);

char model[260];
ke::SafeSprintf(model, sizeof(model), "models/player/%s/%s.mdl", newModel, newModel);
char modelpath[260];
ke::SafeSprintf(modelpath, sizeof(modelpath), "models/player/%s/%s.mdl", newModel, newModel);

for (size_t i = 0; i < HL_MODEL_MAX; ++i)
{
if (Server->model_precache[i] && !strcmp(Server->model_precache[i], model))
if (Server->model_precache[i] && !strcmp(Server->model_precache[i], modelpath))
{
if (pPlayer->v.modelindex != i)
{
SET_MODEL(pPlayer, model);
SET_MODEL(pPlayer, STRING(ALLOC_STRING(modelpath)));
}

set_pdata<int>(pPlayer, m_modelIndexPlayer, i);
Expand Down