coop-deluxe / sm64coopdx

An official continuation of https://github.com/djoslin0/sm64ex-coop on sm64coopdx for the enhancements and progress it already has.
https://sm64coopdx.com
286 stars 41 forks source link

Fix buffer length with coopnet description #192

Closed EmeraldLoc closed 1 month ago

EmeraldLoc commented 1 month ago

Resolves this issue.

So, the issue that was occurring was on line 183 of coopnet.c. On that line, snprintf(buffer, bufferLength, "%s", version); is being ran. This causes a crash due to an overflow. The reason this happens is because the buffer is set to sCoopNetDescription, which has a size of 512, but the bufferLength has a size of 1024. To fix this, I chose to create a definition called MAX_COOPNET_DESCRIPTION_LENGTH, and plug that into the bufferLength and size of sCoopNetDescription, so to change that size, you only have to edit 1 variable.

AgentXLP commented 1 month ago

Thanks for catching this, I probably would have when I did my rounds of testing with people before release but you never know, so this helps.