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
bff64e85
Commit
bff64e85
authored
Nov 15, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Avoid a buffer overflow in CredUnmarshalCredentialW.
Spotted by Stefan Leichter.
parent
6395af1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
cred.c
dlls/advapi32/cred.c
+5
-2
cred.c
dlls/advapi32/tests/cred.c
+8
-0
No files found.
dlls/advapi32/cred.c
View file @
bff64e85
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stdarg.h>
#include <time.h>
#include <time.h>
#include <limits.h>
#ifdef __APPLE__
#ifdef __APPLE__
# include <Security/SecKeychain.h>
# include <Security/SecKeychain.h>
...
@@ -2102,7 +2103,7 @@ static BOOL cred_decode( const WCHAR *cred, unsigned int len, char *buf )
...
@@ -2102,7 +2103,7 @@ static BOOL cred_decode( const WCHAR *cred, unsigned int len, char *buf )
*/
*/
BOOL
WINAPI
CredUnmarshalCredentialW
(
LPCWSTR
cred
,
PCRED_MARSHAL_TYPE
type
,
PVOID
*
out
)
BOOL
WINAPI
CredUnmarshalCredentialW
(
LPCWSTR
cred
,
PCRED_MARSHAL_TYPE
type
,
PVOID
*
out
)
{
{
unsigned
int
len
,
buflen
,
size
;
unsigned
int
len
,
buflen
;
TRACE
(
"%s, %p, %p
\n
"
,
debugstr_w
(
cred
),
type
,
out
);
TRACE
(
"%s, %p, %p
\n
"
,
debugstr_w
(
cred
),
type
,
out
);
...
@@ -2134,8 +2135,10 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
...
@@ -2134,8 +2135,10 @@ BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVO
case
UsernameTargetCredential
:
case
UsernameTargetCredential
:
{
{
USERNAME_TARGET_CREDENTIAL_INFO
*
target
;
USERNAME_TARGET_CREDENTIAL_INFO
*
target
;
ULONGLONG
size
=
0
;
if
(
len
<
9
||
!
cred_decode
(
cred
+
3
,
6
,
(
char
*
)
&
size
)
||
!
size
||
size
%
sizeof
(
WCHAR
))
if
(
len
<
9
||
!
cred_decode
(
cred
+
3
,
6
,
(
char
*
)
&
size
)
||
!
size
||
size
%
sizeof
(
WCHAR
)
||
size
>
INT_MAX
)
{
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
return
FALSE
;
...
...
dlls/advapi32/tests/cred.c
View file @
bff64e85
...
@@ -670,6 +670,14 @@ static void test_CredUnmarshalCredentialA(void)
...
@@ -670,6 +670,14 @@ static void test_CredUnmarshalCredentialA(void)
ok
(
username
->
UserName
!=
NULL
,
"UserName is NULL
\n
"
);
ok
(
username
->
UserName
!=
NULL
,
"UserName is NULL
\n
"
);
ok
(
!
lstrcmpW
(
username
->
UserName
,
testW
),
"got %s
\n
"
,
wine_dbgstr_w
(
username
->
UserName
)
);
ok
(
!
lstrcmpW
(
username
->
UserName
,
testW
),
"got %s
\n
"
,
wine_dbgstr_w
(
username
->
UserName
)
);
pCredFree
(
username
);
pCredFree
(
username
);
type
=
0
;
username
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
pCredUnmarshalCredentialA
(
"@@CA-----0BQZAMHA0BA"
,
&
type
,
(
void
**
)
&
username
);
error
=
GetLastError
();
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
}
}
static
void
test_CredIsMarshaledCredentialA
(
void
)
static
void
test_CredIsMarshaledCredentialA
(
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