[PATCH 1/6] reg: Sanitize key paths in main

Jonathan Vollebregt jnvsor at gmail.com
Tue Oct 28 18:19:45 CDT 2014


On 10/28/2014 09:51 PM, Stefan Dösinger wrote:
> I don't think you need the NULL check with the early return

RegOpenKey always returns an error if path starts with '\\', which is 
why theres an increment on path right after the strchrW

Of course if path_get_key returns NULL we'll be passing in the 
equivalent of `(WCHAR *)2` so the NULL check prevents segfaults.

We could replace the return with the path increment so that RegOpenKey 
gets NULL as it's parameter like this:

>     path = strchrW(path, '\\');
>     if (path)
>         path++;
>
>     if (RegOpenKeyW(k, path, &k) != ERROR_SUCCESS)

I suppose removing a line is worth the extra effort of having root keys 
go through RegOpenKey

How's this draft?

> https://github.com/jnvsor/wine/compare/4bb80af...280d772




More information about the wine-devel mailing list