Skip to content

Commit

Permalink
Verify HudSetParams input when hotbar textures are set (#6013)
Browse files Browse the repository at this point in the history
* Verify HudSetParams input when hotbar textures are set

This fix #6011
  • Loading branch information
nerzhul committed Jun 19, 2017
1 parent 0c429bd commit 4dcc598
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/network/clientpackethandler.cpp
Expand Up @@ -1174,9 +1174,21 @@ void Client::handleCommand_HudSetParam(NetworkPacket* pkt)
player->hud_hotbar_itemcount = hotbar_itemcount;
}
else if (param == HUD_PARAM_HOTBAR_IMAGE) {
// If value not empty verify image exists in texture source
if (value != "" && !getTextureSource()->isKnownSourceImage(value)) {
errorstream << "Server sent wrong Hud hotbar image (sent value: '"
<< value << "')" << std::endl;
return;
}
player->hotbar_image = value;
}
else if (param == HUD_PARAM_HOTBAR_SELECTED_IMAGE) {
// If value not empty verify image exists in texture source
if (value != "" && !getTextureSource()->isKnownSourceImage(value)) {
errorstream << "Server sent wrong Hud hotbar selected image (sent value: '"
<< value << "')" << std::endl;
return;
}
player->hotbar_selected_image = value;
}
}
Expand Down

0 comments on commit 4dcc598

Please sign in to comment.