GetAppConfigDir, GetAppConfigFile, GetWindowsSpecialDir - broken Unicode handling
Original Reporter info from Mantis: dezlov
-
Reporter name: Denis Kozlov
Original Reporter info from Mantis: dezlov
- Reporter name: Denis Kozlov
Description:
GetWindowsSpecialDir is the underlying function of both GetAppConfigDir and GetAppConfigFile.
GetWindowsSpecialDir has encoding and buffer overrun issues. It calls SHGetFolderPathW as if it was SHGetFolderPathA, with under-allocated PChar buffer instead of PWideChar.
Patch and test project attached. Tested with both 3.0 fixes and TRUNK.
Steps to reproduce:
Started of in the mailing list:
http://lists.lazarus.freepascal.org/pipermail/lazarus/2016-March/097907.html
Additional information:
Your command prompt must be able to display Unicode characters for the sample project to work appropriately. Alternatively, redirect output to a file.
You will also need to have a user account name to contain some Unicode characters to actually see the problem and the fix.
Mantis conversion info:
- Mantis ID: 29942
- OS: Windows
- Fixed in version: 3.1.1
- Fixed in revision: 33406 (#ad343008)
- Monitored by: » dezlov (Denis Kozlov)
- Target version: 3.0.2