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

Fix assigning not null-terminated string. #1710

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

likema
Copy link
Contributor

@likema likema commented Nov 1, 2021

The result buffer of ACE_TEXT_RegQueryValueEx may not be null-terminated.

This bug can be also reproduced on 6.5.x branch.

@jwillemsen
Copy link
Member

Please extend one of the unit tests under ACE/tests with a reproducer

@likema
Copy link
Contributor Author

likema commented Nov 1, 2021

Please extend one of the unit tests under ACE/tests with a reproducer

It may not be do it easily.

https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexa#remarks shows

If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the string may not have been stored with the proper terminating null characters. Therefore, even if the function returns ERROR_SUCCESS, the application should ensure that the string is properly terminated before using it; otherwise, it may overwrite a buffer. (Note that REG_MULTI_SZ strings should have two terminating null characters.) One way an application can en`sure that the string is properly terminated is to use RegGetValue, which adds terminating null characters if needed.

@jwillemsen jwillemsen added the needs review Needs to be reviewed label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Needs to be reviewed
Development

Successfully merging this pull request may close these issues.

2 participants