Skip to content
Snippets Groups Projects
Commit 10231180 authored by U-BASIS\cray's avatar U-BASIS\cray
Browse files

Fix for CT-2917 - fail to get non-ascii registry key names

Non-ascii registry key names seem to not be Null terminated. I created three non-ascii keys all of which had no Null termination. I verified manually using a hex editor on the registry hive. This led to conversion issues when calling from_bytes() within getUFT16String(). Solution is to append a UFT16 null char to the end of any string we try to do a conversion on that is not null terminated.
parent 47463ea8
No related branches found
No related tags found
No related merge requests found
...@@ -127,12 +127,13 @@ namespace Rejistry { ...@@ -127,12 +127,13 @@ namespace Rejistry {
if (nullPos == 0) { if (nullPos == 0) {
return L""; return L"";
} }
// NULL Pointer not found
// UFT16 NULL char not found so add it
// Non-ascii registry key names seem to not be NULL terminated
// which leads to conversion errors in from_bytes() (CT-2917)
else if (nullPos == data.size()) { else if (nullPos == data.size()) {
// @@@ BC: I'm not sure if this is correct. But, we got exceptions if data.push_back('\0');
// we kept it past the buffer. data.push_back('\0');
// Are these always supposed to be NULL terminated, in which case this is an error?
nullPos = data.size() - 1;
} }
std::wstring result; std::wstring result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment