mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[NTOS:PNP] Correctly respect data size in PnpRegSzToString. CORE-15766
Spotted by Vadim Galyant.
This commit is contained in:
parent
c83d7ba185
commit
cf40421041
|
@ -175,11 +175,20 @@ PnpRegSzToString(IN PWCHAR RegSzData,
|
||||||
PWCHAR p, pp;
|
PWCHAR p, pp;
|
||||||
|
|
||||||
/* Find the end */
|
/* Find the end */
|
||||||
pp = RegSzData + RegSzLength;
|
pp = RegSzData + RegSzLength / sizeof(WCHAR);
|
||||||
for (p = RegSzData; p < pp; p++) if (!*p) break;
|
for (p = RegSzData; p < pp; p++)
|
||||||
|
{
|
||||||
|
if (!*p)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Return it */
|
/* Return the length. Truncation can happen but is of no consequence. */
|
||||||
if (StringLength) *StringLength = (USHORT)(p - RegSzData) * sizeof(WCHAR);
|
if (StringLength)
|
||||||
|
{
|
||||||
|
*StringLength = (USHORT)(p - RegSzData) * sizeof(WCHAR);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue