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
7d54f9a8
Commit
7d54f9a8
authored
Oct 06, 2020
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Fix buffer size query in BCryptExportKey.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ab0a7d2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+13
-10
No files found.
dlls/bcrypt/bcrypt_main.c
View file @
7d54f9a8
...
...
@@ -968,11 +968,13 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
*
size
=
req_size
;
if
(
output_len
<
req_size
)
return
STATUS_BUFFER_TOO_SMALL
;
header
->
dwMagic
=
BCRYPT_KEY_DATA_BLOB_MAGIC
;
header
->
dwVersion
=
BCRYPT_KEY_DATA_BLOB_VERSION1
;
header
->
cbKeyData
=
key
->
u
.
s
.
secret_len
;
memcpy
(
&
header
[
1
],
key
->
u
.
s
.
secret
,
key
->
u
.
s
.
secret_len
);
if
(
output
)
{
header
->
dwMagic
=
BCRYPT_KEY_DATA_BLOB_MAGIC
;
header
->
dwVersion
=
BCRYPT_KEY_DATA_BLOB_VERSION1
;
header
->
cbKeyData
=
key
->
u
.
s
.
secret_len
;
memcpy
(
&
header
[
1
],
key
->
u
.
s
.
secret
,
key
->
u
.
s
.
secret_len
);
}
return
STATUS_SUCCESS
;
}
else
if
(
!
wcscmp
(
type
,
BCRYPT_OPAQUE_KEY_BLOB
))
...
...
@@ -981,9 +983,11 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
*
size
=
req_size
;
if
(
output_len
<
req_size
)
return
STATUS_BUFFER_TOO_SMALL
;
*
(
ULONG
*
)
output
=
key
->
u
.
s
.
secret_len
;
memcpy
(
output
+
sizeof
(
len
),
key
->
u
.
s
.
secret
,
key
->
u
.
s
.
secret_len
);
if
(
output
)
{
*
(
ULONG
*
)
output
=
key
->
u
.
s
.
secret_len
;
memcpy
(
output
+
sizeof
(
len
),
key
->
u
.
s
.
secret
,
key
->
u
.
s
.
secret_len
);
}
return
STATUS_SUCCESS
;
}
else
if
(
!
wcscmp
(
type
,
BCRYPT_RSAPUBLIC_BLOB
)
||
!
wcscmp
(
type
,
BCRYPT_DSA_PUBLIC_BLOB
)
||
...
...
@@ -991,8 +995,7 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
{
*
size
=
key
->
u
.
a
.
pubkey_len
;
if
(
output_len
<
key
->
u
.
a
.
pubkey_len
)
return
STATUS_SUCCESS
;
memcpy
(
output
,
key
->
u
.
a
.
pubkey
,
key
->
u
.
a
.
pubkey_len
);
if
(
output
)
memcpy
(
output
,
key
->
u
.
a
.
pubkey
,
key
->
u
.
a
.
pubkey_len
);
return
STATUS_SUCCESS
;
}
else
if
(
!
wcscmp
(
type
,
BCRYPT_ECCPRIVATE_BLOB
))
...
...
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