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

Stefan Dösinger stefandoesinger at gmail.com
Mon Oct 27 17:55:39 CDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

This patch is a lot more readable than the past version IMO. I'll look at the other patches tomorrow.

Am 2014-10-27 13:10, schrieb Jonathan Vollebregt:
> +static WCHAR *sanitize_path(WCHAR *key){
Inconsistent curly bracket placement. The other patches have more cases of that.

> +        else
> +            reg_message(STRING_INVALID_KEY);
Doesn't get_rootkey() implicitly take care of this? I don't see why you need an extra check for a single leading backslash.

There's one (intended?) side effect of this check though: It ensures that the code below doesn't crash on the input string "\\".

> +    i = strlenW(key);
> +    if (key[i - 1] == '\\')
> +        key[i - 1] = 0;
Why do you need this? The existing code and the todo_wine test suggests that RegCreateKey accepts any number of trailing slashes. Adding a test for this in dlls/advapi32/tests/registry.c would be a good idea.

This is the only case where you modify the input string. If it indeed is not necessary you can change the parameter to a const WCHAR * and return a BOOL.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJUTs1oAAoJEN0/YqbEcdMw0rsP/3XocRwBZ2zPgs/0ERHMOL0q
84+09LlpOMMBzEQDue4WnxLgNwT6EUdP1W+CpMLtjdh6r35qePWRuHwrieuRoKsF
7SoZhAqB1XGfSTfHC5yaSlC3a3didsGn8wCvb9R66wFcBstWY+wW9cdnyUzRhXeK
oowmLBioiKlWGHBX84k7pvxLEzokeW+yEj0D/NXaVeFJ5ATfsqRynIiMJOeMJzJj
XcnrH9YBDzvOy36zSREclwEtwt73dZ9dRYiLO4fHaaqsBMM0xiuZYl5CkfUxGjtm
/c33mOOUl4l9EEpQLdu6kMtrT6kF13XbT2ume0AcqTbL4KrJVl7j173wck0vt1e7
kaLS1ViU4TGxHHo7mkqfMUjDpJM1tR5etV9DqQGQYui+BQ1ZOTpISrmuFxbXPAOd
ecwvZGXEePGWrZlsV4lECc25/1BJQfEpxKK/5pc6fTv0TYd+JGOOnOSlTR9xlOSW
rs/mjTuedQDNIFr+RvfMK+OpJIXXA9ve0jkpDX0XLnl3lZWG0p+rGholQXwHC5VS
1YUucH8moIW/8kN1s39/RSzcBgkxvAEDgiFsIigYqyEnPpafTbSQn3rNIVD5DQ0X
+Fy7gBffr+uaOSKAh8ShdMGvRFGipd4WNQTelemCVcD1Pku2X01ImBImyHeMxBzW
2JdXxGTtZT8PribxigHn
=eTay
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list