[PATCH] QueryDosDevice in handle_to_fn

Brian Dessent brian@dessent.net
Sun Mar 16 15:42:00 GMT 2008

Corinna Vinschen wrote:

> len is a const value.  Checking len for being < 65536 is a constant
> expression which always results in qddlen being 65535 so the ?: is
> a noop, more or less.

Yeah, I realized that, and the compiler should optimize it away
completely.  I put it explicitly as a test in the source just for safety
so that if in the future somebody changes the definition of NT_MAX_PATH
or len for some reason and forgets to touch this part that things work
correctly without any overflows.

> Did you test if QueryDosDeviceW has the same problem as QueryDosDeviceA?
> If not, we should use that function.

No, but that's a good idea.  I'll check that and if it doesn't have this
quirk I'll see about moving to do the bulk of the function with WCHARs.


More information about the Cygwin-patches mailing list