Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command block can crash server #121

Open
SwissalpS opened this issue Jul 31, 2024 · 2 comments
Open

command block can crash server #121

SwissalpS opened this issue Jul 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@SwissalpS
Copy link
Contributor

< FeXoR@pandorabox> Triggering "lc [channel]" with a command block owned by an offline player crashes the server if triggered by another player (not verbatum quote)

Not something that should happen often. Maybe checking if player object actually exists (player is online) on chatcommands would be a straightforward way to harden against such situations.

@SwissalpS SwissalpS added the bug Something isn't working label Jul 31, 2024
@S-S-X
Copy link
Member

S-S-X commented Jul 31, 2024

Was probably this one:

2024-07-31 02:53:05: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '??' in callback environment_Step(): /data/world//worldmods/beerchat/chatcommands.lua:184: attempt to index a nil value
2024-07-31 02:53:05: ERROR[Main]: stack traceback:
2024-07-31 02:53:05: ERROR[Main]: 	/data/world//worldmods/beerchat/chatcommands.lua:184: in function 'func'
2024-07-31 02:53:05: ERROR[Main]: 	...world//worldmods/mesecons/mesecons_commandblock/init.lua:167: in function 'action_on'
2024-07-31 02:53:05: ERROR[Main]: 	/data/world//worldmods/mesecons/mesecons/internal.lua:184: in function </data/world//worldmods/mesecons/mesecons/internal.lua:177>
2024-07-31 02:53:05: ERROR[Main]: 	/data/world//worldmods/mesecons/mesecons/actionqueue.lua:137: in function 'f'
2024-07-31 02:53:05: ERROR[Main]: 	/data/world//worldmods/monitoring/metrictypes/counter.lua:43: in function 'old_execute'
2024-07-31 02:53:05: ERROR[Main]: 	...d//worldmods/mesecons_debug/overrides/mesecons_queue.lua:27: in function 'execute'
2024-07-31 02:53:05: ERROR[Main]: 	/data/world//worldmods/mesecons/mesecons/actionqueue.lua:111: in function 'globalstep'
2024-07-31 02:53:05: ERROR[Main]: 	/data/world//worldmods/monitoring/builtin/globalstep.lua:73: in function </data/world//worldmods/monitoring/builtin/globalstep.lua:55>
2024-07-31 02:53:05: ERROR[Main]: 	/usr/local/share/minetest/builtin/common/register.lua:26: in function </usr/local/share/minetest/builtin/common/register.lua:12>

@S-S-X
Copy link
Member

S-S-X commented Jul 31, 2024

Line 184 seems like straightforward easy fix

beerchat/chatcommands.lua

Lines 184 to 186 in 4b146cc

if not beerchat.playersChannels[name][channel] then
return false, "ERROR: You are not member of " .. channel .. ", no need to leave."
end

However I'm pretty sure there's a lot of similar stuff where it is simply just assumed that player who executed the command is online.

I think long ago it was already determined that many commands would crash the server with similar reason if executed remotely, back then remote execution was just disabled. Could extend Beerchat API a bit and add these common internal lookups there and fix these corner cases while doing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants