[PATCH 3/8] reg: Add check for multiple backslashes at the end of the key

Jonathan Vollebregt jnvsor at gmail.com
Thu Nov 6 15:17:37 CST 2014


---
 programs/reg/reg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index fa7b2df..186ba47 100755
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -77,6 +77,8 @@ static int reg_print_error(LSTATUS error_code)
             return 0;
         case ERROR_BAD_COMMAND:
             return reg_message(STRING_INVALID_CMDLINE);
+        case ERROR_INVALID_HANDLE:
+            return reg_message(STRING_INVALID_KEY);
         case ERROR_NO_REMOTE:
             return reg_message(STRING_NO_REMOTE);
         default:
@@ -194,6 +196,9 @@ static LSTATUS sane_path(const WCHAR *key)
 {
     int i = strlenW(key);
 
+    if (i < 3 || (key[i - 1] == '\\' && key[i - 2] == '\\'))
+        return ERROR_INVALID_HANDLE;
+
     if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\')
         return ERROR_NO_REMOTE;
 
-- 
2.1.1




More information about the wine-patches mailing list