From: Loïc Blot Date: Mon, 19 Jun 2017 12:10:30 +0000 (+0200) Subject: Verify HudSetParams input when hotbar textures are set (#6013) X-Git-Tag: 0.4.17~114 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5f796f7a042576f848e969c77b25b4b9e4112b77;p=oweals%2Fminetest.git Verify HudSetParams input when hotbar textures are set (#6013) * Verify HudSetParams input when hotbar textures are set This fix #6011 --- diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 59669fe6d..8935ed90c 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1172,9 +1172,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; } }