|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 4/8] registry: Fix wrong truncation of Unicode.Length
Assisted-by: ClaudeCode:claude-opus-4.8
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
src/common/registry.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/common/registry.c b/src/common/registry.c
index 1f7a73c..204e2e8 100644
--- a/src/common/registry.c
+++ b/src/common/registry.c
@@ -1460,11 +1460,13 @@ RegistryAnsiToSz(
if (Partial == NULL)
goto fail1;
+ ASSERT3U(Length * sizeof (WCHAR), <=, 0xFFFF); // MAX_USHORT
+
Partial->TitleIndex = 0;
Partial->Type = REG_SZ;
Partial->DataLength = Length * sizeof (WCHAR);
- Unicode.MaximumLength = (UCHAR)Partial->DataLength;
+ Unicode.MaximumLength = (USHORT)Partial->DataLength;
Unicode.Buffer = (PWCHAR)Partial->Data;
Unicode.Length = 0;
--
2.51.2.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |