mirror of
https://github.com/minetest/minetest.git
synced 2024-12-02 12:33:45 +01:00
Verify HudSetParams input when hotbar textures are set (#6013)
* Verify HudSetParams input when hotbar textures are set This fix #6011
This commit is contained in:
parent
7aa52fe4e1
commit
5f796f7a04
@ -1172,9 +1172,21 @@ void Client::handleCommand_HudSetParam(NetworkPacket* pkt)
|
|||||||
player->hud_hotbar_itemcount = hotbar_itemcount;
|
player->hud_hotbar_itemcount = hotbar_itemcount;
|
||||||
}
|
}
|
||||||
else if (param == HUD_PARAM_HOTBAR_IMAGE) {
|
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;
|
player->hotbar_image = value;
|
||||||
}
|
}
|
||||||
else if (param == HUD_PARAM_HOTBAR_SELECTED_IMAGE) {
|
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;
|
player->hotbar_selected_image = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user