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

Add a guard to prevent a buffer overflow when saving a game #6647

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Garanas
Copy link
Member

@Garanas Garanas commented Feb 7, 2025

Description of the proposed changes

According to @4z0t there's a possible buffer overflow in this function. This function is exposed to UI mods. It would technically allow a UI mod to run arbitrary code when the UI mod is enabled.

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@github-actions github-actions bot marked this pull request as draft February 7, 2025 16:02
---@param filename string
_G.InternalSaveGame = function(filename, friendlyFilename, onCompletionCallback)
if DebugAllocatedSize(filename) > 50 then
filename = filename:sub(0, 50)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lua is 1-indexed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f8ef972

@Garanas Garanas marked this pull request as ready for review February 7, 2025 16:48
@Garanas Garanas requested a review from 4z0t February 7, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants