Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
303daeef
Commit
303daeef
authored
Mar 15, 2016
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Fix null termination in RegQueryInfoKeyA.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fda55a3f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
registry.c
dlls/advapi32/registry.c
+1
-1
registry.c
dlls/advapi32/tests/registry.c
+22
-0
No files found.
dlls/advapi32/registry.c
View file @
303daeef
...
...
@@ -1162,12 +1162,12 @@ LSTATUS WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDW
(
WCHAR
*
)(
buf_ptr
+
info
->
ClassOffset
),
info
->
ClassLength
);
if
(
len
)
{
class
[
len
-
1
]
=
0
;
if
(
*
class_len
+
1
>
len
)
{
status
=
STATUS_BUFFER_OVERFLOW
;
*
class_len
-=
1
;
}
class
[
*
class_len
]
=
0
;
}
}
else
status
=
STATUS_SUCCESS
;
...
...
dlls/advapi32/tests/registry.c
View file @
303daeef
...
...
@@ -1987,6 +1987,17 @@ static void test_reg_query_info(void)
"classbuffer =
\"
%.*s
\"
, expected %s
\n
"
,
(
int
)
sizeof
(
classbuffer
),
classbuffer
,
expectbuffer
);
memset
(
classbuffer
,
0x55
,
sizeof
(
classbuffer
));
classlen
=
0xdeadbeef
;
ret
=
RegQueryInfoKeyA
(
subkey
,
classbuffer
,
&
classlen
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_SUCCESS
,
"ret = %d
\n
"
,
ret
);
ok
(
classlen
==
sizeof
(
subkey_class
)
-
1
,
"classlen = %u
\n
"
,
classlen
);
memset
(
expectbuffer
,
0x55
,
sizeof
(
expectbuffer
));
strcpy
(
expectbuffer
,
subkey_class
);
ok
(
!
memcmp
(
classbuffer
,
expectbuffer
,
sizeof
(
classbuffer
)),
"classbuffer =
\"
%.*s
\"
, expected %s
\n
"
,
(
int
)
sizeof
(
classbuffer
),
classbuffer
,
expectbuffer
);
memset
(
classbufferW
,
0x55
,
sizeof
(
classbufferW
));
classlen
=
sizeof
(
subkey_class
);
ret
=
RegQueryInfoKeyW
(
subkey
,
classbufferW
,
&
classlen
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
...
...
@@ -1998,6 +2009,17 @@ static void test_reg_query_info(void)
"classbufferW = %s, expected %s
\n
"
,
wine_dbgstr_wn
(
classbufferW
,
sizeof
(
classbufferW
)
/
sizeof
(
WCHAR
)),
wine_dbgstr_w
(
expectbufferW
));
memset
(
classbufferW
,
0x55
,
sizeof
(
classbufferW
));
classlen
=
0xdeadbeef
;
ret
=
RegQueryInfoKeyW
(
subkey
,
classbufferW
,
&
classlen
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_SUCCESS
,
"ret = %d
\n
"
,
ret
);
ok
(
classlen
==
sizeof
(
subkey_class
)
-
1
,
"classlen = %u
\n
"
,
classlen
);
memset
(
expectbufferW
,
0x55
,
sizeof
(
expectbufferW
));
lstrcpyW
(
expectbufferW
,
subkey_classW
);
ok
(
!
memcmp
(
classbufferW
,
expectbufferW
,
sizeof
(
classbufferW
)),
"classbufferW = %s, expected %s
\n
"
,
wine_dbgstr_wn
(
classbufferW
,
sizeof
(
classbufferW
)
/
sizeof
(
WCHAR
)),
wine_dbgstr_w
(
expectbufferW
));
RegDeleteKeyA
(
subsubkey
,
""
);
RegCloseKey
(
subsubkey
);
RegDeleteKeyA
(
subkey
,
""
);
...
...
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