RE: [PATCH v3 04/10] reg: Add sane_path function to do preliniary key validation
On Saturday, 8 Nov 2014 11:26:45 +0100, Jonathan Vollebregt wrote:
+static LSTATUS sane_path(const WCHAR *key) +{ + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') + return ERROR_NO_REMOTE; + + return ERROR_SUCCESS; +}Where are you handling (invalid) keys beginning with backslashes, e.g.: \\HKEY_CURRENT_USER\\Console? Windows only allows two consecutive backslashes at the beginning of a key.
+ if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') HKEY... --> ERROR_SUCCESS \HKEY... --> ERROR_SUCCESS !!! \\HKEY... --> ERROR_NO_REMOTE \\\HKEY... --> ERROR_SUCCESS !!!
Those two marked with !!! need to be handled. Do you do this in a later patch? -- Hugh McMaster
Yes, they're in 6: path/key functions Stefan suggested to leave that validation out of sane_path since path_get_rootkey will error out if it starts with a slash anyway On 11/10/2014 12:18 PM, Hugh McMaster wrote:
On Saturday, 8 Nov 2014 11:26:45 +0100, Jonathan Vollebregt wrote:
+static LSTATUS sane_path(const WCHAR *key) +{ + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') + return ERROR_NO_REMOTE; + + return ERROR_SUCCESS; +}Where are you handling (invalid) keys beginning with backslashes, e.g.: \\HKEY_CURRENT_USER\\Console? Windows only allows two consecutive backslashes at the beginning of a key.
+ if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') HKEY... --> ERROR_SUCCESS \HKEY... --> ERROR_SUCCESS !!! \\HKEY... --> ERROR_NO_REMOTE \\\HKEY... --> ERROR_SUCCESS !!!
Those two marked with !!! need to be handled. Do you do this in a later patch?
-- Hugh McMaster
On Monday, 10 Nov 2014 12:23:39 +0100, Jonathan Vollebregt wrote:
Yes, they're in 6: path/key functions
Stefan suggested to leave that validation out of sane_path since path_get_rootkey will error out if it starts with a slash anyway
Okay, I see it now. Always listen to Stefan. :)
participants (2)
-
Hugh McMaster -
Jonathan Vollebregt