ntdll: Fix the overflow check in read_changes_apc().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ad9fb96e5b
commit
cd2e053237
|
@ -1768,16 +1768,17 @@ static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS st
|
||||||
|
|
||||||
while (size && left >= sizeof(*pfni))
|
while (size && left >= sizeof(*pfni))
|
||||||
{
|
{
|
||||||
|
DWORD len = (left - offsetof(FILE_NOTIFY_INFORMATION, FileName)) / sizeof(WCHAR);
|
||||||
|
|
||||||
/* convert to an NT style path */
|
/* convert to an NT style path */
|
||||||
for (i = 0; i < event->len; i++)
|
for (i = 0; i < event->len; i++)
|
||||||
if (event->name[i] == '/') event->name[i] = '\\';
|
if (event->name[i] == '/') event->name[i] = '\\';
|
||||||
|
|
||||||
pfni->Action = event->action;
|
pfni->Action = event->action;
|
||||||
pfni->FileNameLength = ntdll_umbstowcs( event->name, event->len, pfni->FileName,
|
pfni->FileNameLength = ntdll_umbstowcs( event->name, event->len, pfni->FileName, len );
|
||||||
(left - offsetof(FILE_NOTIFY_INFORMATION, FileName)) / sizeof(WCHAR));
|
|
||||||
last_entry_offset = &pfni->NextEntryOffset;
|
last_entry_offset = &pfni->NextEntryOffset;
|
||||||
|
|
||||||
if (pfni->FileNameLength == -1 || pfni->FileNameLength == -2) break;
|
if (pfni->FileNameLength == len) break;
|
||||||
|
|
||||||
i = offsetof(FILE_NOTIFY_INFORMATION, FileName[pfni->FileNameLength]);
|
i = offsetof(FILE_NOTIFY_INFORMATION, FileName[pfni->FileNameLength]);
|
||||||
pfni->FileNameLength *= sizeof(WCHAR);
|
pfni->FileNameLength *= sizeof(WCHAR);
|
||||||
|
|
Loading…
Reference in New Issue