[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: Re: setupapi: prevent page faults in
From: Christopher <raccoonone () procyongames ! com>
Date: 2008-03-31 16:38:42
Message-ID: 47F11392.6030804 () procyongames ! com
[Download RAW message or body]
wine-devel-request@winehq.org wrote:
> Message: 4 Date: Sun, 30 Mar 2008 19:13:46 -0600 From: Vitaliy
> Margolen <wine-devel@kievinfo.com> Subject: Re: setupapi: prevent page
> faults in SetupDiDeleteDeviceInterfaceRegKey To: wine-devel@winehq.org
> Message-ID: <47F03ACA.5010308@kievinfo.com> Content-Type: text/plain;
> charset=ISO-8859-1; format=flowed Christopher wrote:
> > > Changelog:
> > > Check that the handle and pointer passed to
> > > SetupDiDeleteDeviceInterfaceRegKey are valid to read from. This patch
> > > continues to address bug #12242
> > >
> > > - if (!DeviceInterfaceData ||
> > > + if (!DeviceInterfaceData || IsBadReadPtr(DeviceInterfaceData, \
> > > sizeof(SP_DEVICE_INTERFACE_DATA)) ||
> >
>
> Don't ever use IsBadReadPtr and IsBadWritePtr functions. They are bad and
> even MS stopped using them. You have to use TRY-EXCEPT block around an
> access to the memory. For example see implementation of lstrcpyA
> (kernel32/string.c: 359).
>
>
> > > + ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "Expected \
> > > SetupDiDeleteDeviceInterfaceRegKey to return FALSE, got %s, \ +with error code: \
> > > 6, got %d\n", ret ? "TRUE" : "FALSE", GetLastError());
> >
>
> This is bad way to split strings in c. Do something like this:
>
> ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
> "Expected SetupDiDeleteDeviceInterfaceRegKey to return FALSE, got %s, "
> "with error code: 6, got %d\n", ret ? "TRUE" : "FALSE", GetLastError());
>
> Vitaliy.
Thanks for the comments! I found that Alexander Morozov's patches fix
the same issue my patch was aimed at. After his are committed, I'll fix
and resubmit mine if it's needed.
Christopher Berner
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic