|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/8] registry: Fix wrong truncation of Unicode.Length
On 14/08/2026 09:30, Owen Smith wrote: > 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 Other drivers will need the same patch as well. > index 1f7a73c..204e2e8 100644 > --- a/src/common/registry.c > +++ b/src/common/registry.c > @@ -1460,11 +1460,13 @@ RegistryAnsiToSz( Should RegistryAnsiToMultiSz be updated in the same way? > if (Partial == NULL) > goto fail1; > > + ASSERT3U(Length * sizeof (WCHAR), <=, 0xFFFF); // MAX_USHORT > + If the intent is to unconditionally truncate if RtlAnsiStringToUnicodeString fails, I don't know if we would want another assert here. If that's not the case, wouldn't it be better to simply remove the truncation code path and fail? > 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; > -- Ngoc Tu Dinh | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |