mc-monitor icon indicating copy to clipboard operation
mc-monitor copied to clipboard

String buffer overflow on status for long forge modlists

Open chloeruka opened this issue 2 years ago • 0 comments

I'm running an Enigmatica6 server on Forge 1.16.5. FML2 handshakes grow linearly with the mod list as they use it to confirm client compatibility:

❯ docker run -it -e DEBUG=true --rm itzg/mc-monitor status --host [REDACTED] --port 25565
2022-09-20T13:10:25.277Z        DEBUG   mc-monitor/java_status.go:76    pinging
2022-09-20T13:10:25.435Z        DEBUG   mc-monitor/java_status.go:79    ping returned   {"error": "string length out of bounds", "info": null}
failed to ping [REDACTED]:25565 : string length out of bounds%

After flushing this one out for a while, it seems to be that once the handshake reply is beyond math.MaxInt16 or 65535 bytes, mc-pinger breaks and returns a slightly nebulous error. This makes my LivenessProbe fail and I want to use mc-monitor if I can. 😄

I'm mostly writing this issue as documentation of this quirk in case it saves another time-poor weekend server op some time. I have a quick and dirty way of fixing this issue, but it does involve a slightly less obvious change in a forthcoming PR. I'll also try to relay this upstream in case @raqbit feels up to tackling it or can direct us where to help out, though it appears there's some refactoring work that might need to be done.

chloeruka avatar Sep 20 '22 13:09 chloeruka