Skip to content

Conversation

@MegaManSec
Copy link

Previously, when overriding argc/argv from the window location hash, the code built temporary std::vector<std::string> and std::vector<const char*> on the stack, then reassigned argv to their .data(). Once the block ended, both vectors were destroyed, leaving argv pointing into freed memory (UAF).

This patch makes the vectors static, ensuring their storage lives for the entire program lifetime and preventing the invalid pointer access.

Previously, when overriding `argc/argv` from the window location hash,
the code built temporary `std::vector<std::string>` and
`std::vector<const char*>` on the stack, then reassigned `argv` to
their `.data()`. Once the block ended, both vectors were destroyed,
leaving `argv` pointing into freed memory (UAF).

This patch makes the vectors `static`, ensuring their storage lives for
the entire program lifetime and preventing the invalid pointer access.
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.

1 participant