Skip to content

Fix wrong parameter passed to getModuleFileName #655

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

Conversation

vladislav-ryabov
Copy link
Contributor

@vladislav-ryabov vladislav-ryabov commented Jun 21, 2023

status = NEO::SysCalls::getModuleFileName(handle, pathW, sizeof(pathW));

MAX_PATH should be passed instead of sizeof(pathW) since it calls GetModuleFileNameW and

[in] nSize

The size of the lpFilename buffer, in TCHARs.

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

Signed-off-by: Vladislav Ryabov [email protected]

@JablonskiMateusz
Copy link
Contributor

Hi @vladislav-ryabov
nice catch :)
please add signed-off-by to your commit msg

@vladislav-ryabov vladislav-ryabov force-pushed the getModuleFileName_parameter_fix branch from c64ae9a to a30d2ea Compare June 22, 2023 08:52
The size was passed in bytes, not in number of TCHARs.

Signed-off-by: Vladislav Ryabov <[email protected]>
@vladislav-ryabov vladislav-ryabov force-pushed the getModuleFileName_parameter_fix branch from a30d2ea to fb2dced Compare June 22, 2023 08:54
@vladislav-ryabov
Copy link
Contributor Author

@JablonskiMateusz done.

@JablonskiMateusz JablonskiMateusz added the merged change was merged label Jun 23, 2023
@JablonskiMateusz
Copy link
Contributor

Change merged 6d41a6b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged change was merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants