Skip to content

Server crashes if generated chat message is too long #9326

@gpcf

Description

@gpcf
Minetest version
Minetest 5.2.0-dev-03e1f23a (Linux)

OS / Hardware

Operating system: Debian 10
CPU: Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz

Summary

Server crashes if a generated chat message is too long with the following output:

2020-01-19 21:22:47: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback on_chat_message(): String too long
2020-01-19 21:22:47: ERROR[Main]: stack traceback:
2020-01-19 21:22:47: ERROR[Main]:       [C]: in function 'chat_send_player'
2020-01-19 21:22:47: ERROR[Main]:       /usr/share/games/minetest/builtin/game/chat.lua:71: in function </usr/share/games/minetest/builtin/game/chat.lua:48>
2020-01-19 21:22:47: ERROR[Main]:       /usr/share/games/minetest/builtin/game/register.lua:429: in function </usr/share/games/minetest/builtin/game/register.lua:413>

In this case, it was caused by /list_areas from the areas mod, on a server with 10k+ areas. Given the number of mods that might take user input, this could be a serious security risk.

Steps to reproduce

call minetest.chat_send_player with an extremely long chat message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @ Script APIBugIssues that were confirmed to be a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions