mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[KS]
- Use correct buffer size in KspStartBusDevice. Spotted by Víctor Martínez - Avoid wcscpy in kernel mode while we're at it svn path=/trunk/; revision=63778
This commit is contained in:
parent
602fd06fa1
commit
fd1986de3a
2 changed files with 6 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <portcls.h>
|
||||
#include <kcom.h>
|
||||
#include <pseh/pseh2.h>
|
||||
#include <ntstrsafe.h>
|
||||
|
||||
#include "ksiface.h"
|
||||
#include "kstypes.h"
|
||||
|
|
|
@ -757,12 +757,13 @@ KspStartBusDevice(
|
|||
NTSTATUS Status;
|
||||
ULONG ResultLength;
|
||||
LPWSTR Name;
|
||||
ULONG NameLength;
|
||||
PBUS_DEVICE_ENTRY DeviceEntry;
|
||||
|
||||
/* FIXME handle pending remove */
|
||||
|
||||
/* get full device name */
|
||||
Status = IoGetDeviceProperty(DeviceObject, DevicePropertyPhysicalDeviceObjectName, sizeof(PDOName), (PVOID)PDOName, &ResultLength);
|
||||
Status = IoGetDeviceProperty(DeviceObject, DevicePropertyPhysicalDeviceObjectName, sizeof(PDOName), PDOName, &ResultLength);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -771,7 +772,8 @@ KspStartBusDevice(
|
|||
}
|
||||
|
||||
/* allocate device name buffer */
|
||||
Name = AllocateItem(NonPagedPool, (ResultLength + 1) * sizeof(WCHAR));
|
||||
NameLength = ResultLength + sizeof(UNICODE_NULL);
|
||||
Name = AllocateItem(NonPagedPool, NameLength);
|
||||
if (!Name)
|
||||
{
|
||||
/* no memory */
|
||||
|
@ -779,7 +781,7 @@ KspStartBusDevice(
|
|||
}
|
||||
|
||||
/* copy name */
|
||||
wcscpy(Name, PDOName);
|
||||
NT_VERIFY(NT_SUCCESS(RtlStringCbCopyW(Name, NameLength, PDOName)));
|
||||
|
||||
/* TODO: time stamp creation time */
|
||||
|
||||
|
|
Loading…
Reference in a new issue