Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
797520db
Commit
797520db
authored
Apr 20, 2021
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Fail if a system key has a trailing backslash but no subkey path.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6d2ab37a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
reg.c
programs/reg/reg.c
+13
-3
add.c
programs/reg/tests/add.c
+4
-4
No files found.
programs/reg/reg.c
View file @
797520db
...
@@ -234,9 +234,6 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
...
@@ -234,9 +234,6 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
if
(
!
sane_path
(
key
))
if
(
!
sane_path
(
key
))
return
FALSE
;
return
FALSE
;
*
path
=
wcschr
(
key
,
'\\'
);
if
(
*
path
)
(
*
path
)
++
;
*
root
=
path_get_rootkey
(
key
);
*
root
=
path_get_rootkey
(
key
);
if
(
!*
root
)
if
(
!*
root
)
{
{
...
@@ -244,6 +241,19 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
...
@@ -244,6 +241,19 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path)
return
FALSE
;
return
FALSE
;
}
}
*
path
=
wcschr
(
key
,
'\\'
);
if
(
!*
path
)
return
TRUE
;
(
*
path
)
++
;
if
(
!**
path
)
{
output_message
(
STRING_INVALID_SYSTEM_KEY
);
return
FALSE
;
}
return
TRUE
;
return
TRUE
;
}
}
...
...
programs/reg/tests/add.c
View file @
797520db
...
@@ -311,12 +311,12 @@ static void test_key_formats(void)
...
@@ -311,12 +311,12 @@ static void test_key_formats(void)
/* Test validity of trailing backslash after system key */
/* Test validity of trailing backslash after system key */
run_reg_exe
(
"reg add HKCU
\\
/v Value1 /t REG_SZ /d foo /f"
,
&
r
);
run_reg_exe
(
"reg add HKCU
\\
/v Value1 /t REG_SZ /d foo /f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
todo_wine
verify_reg_nonexist
(
HKEY_CURRENT_USER
,
"Value1"
);
verify_reg_nonexist
(
HKEY_CURRENT_USER
,
"Value1"
);
run_reg_exe
(
"reg add HKEY_CURRENT_USER
\\
/v Value2 /t REG_SZ /d bar /f"
,
&
r
);
run_reg_exe
(
"reg add HKEY_CURRENT_USER
\\
/v Value2 /t REG_SZ /d bar /f"
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
todo_wine
verify_reg_nonexist
(
HKEY_CURRENT_USER
,
"Value2"
);
verify_reg_nonexist
(
HKEY_CURRENT_USER
,
"Value2"
);
}
}
static
void
test_add
(
void
)
static
void
test_add
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment