aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-06-19 14:10:30 +0200
committerGitHub <noreply@github.com>2017-06-19 14:10:30 +0200
commit4dcc5985df4c94705ed7e4932a8b82a6e8c61f58 (patch)
treebd6c9b4442d325c7f8862c26c0183e1efddeabb4 /src
parent0c429bd1645d738e721f713429d8ba83c3964b8f (diff)
downloadminetest-4dcc5985df4c94705ed7e4932a8b82a6e8c61f58.tar.gz
minetest-4dcc5985df4c94705ed7e4932a8b82a6e8c61f58.tar.bz2
minetest-4dcc5985df4c94705ed7e4932a8b82a6e8c61f58.zip
Verify HudSetParams input when hotbar textures are set (#6013)
* Verify HudSetParams input when hotbar textures are set This fix #6011
Diffstat (limited to 'src')
-rw-r--r--src/network/clientpackethandler.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 6d6486160..e6f0d7092 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -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;
}
}