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

Potential Buffer Overflow #79

Open
tay10r opened this issue Apr 12, 2024 · 0 comments
Open

Potential Buffer Overflow #79

tay10r opened this issue Apr 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working minor Minor issue, roughly 2 - 4 weeks

Comments

@tay10r
Copy link

tay10r commented Apr 12, 2024

if (0 < GetModuleFileName(hModule, szPath, sizeof(szPath))) {

The third parameter expresses the buffer being larger than it actually is, since the size of wchar_t is greater than 1.

The function documentation is here.

https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamea

The docs mention that the third parameter is the size of the buffer in terms of TCHARS.
Which means that it is more of an element count, than a byte count.
I believe it should be set to MAX_PATH.

@xxEoD2242 xxEoD2242 self-assigned this Aug 31, 2024
@xxEoD2242 xxEoD2242 added bug Something isn't working minor Minor issue, roughly 2 - 4 weeks labels Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor Minor issue, roughly 2 - 4 weeks
Projects
None yet
Development

No branches or pull requests

2 participants