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
0cffcb77
Commit
0cffcb77
authored
Sep 21, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 21, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Fix handling of zero account and domain size parameters in LookupAccountSid.
parent
02bdbbc4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
security.c
dlls/advapi32/security.c
+12
-3
security.c
dlls/advapi32/tests/security.c
+11
-1
No files found.
dlls/advapi32/security.c
View file @
0cffcb77
...
...
@@ -2069,6 +2069,11 @@ LookupAccountSidA(
}
else
*
domainSize
=
domainSizeW
+
1
;
}
else
{
*
accountSize
=
accountSizeW
+
1
;
*
domainSize
=
domainSizeW
+
1
;
}
HeapFree
(
GetProcessHeap
(),
0
,
systemW
);
HeapFree
(
GetProcessHeap
(),
0
,
accountW
);
...
...
@@ -2225,8 +2230,11 @@ LookupAccountSidW(
if
(
domain
)
lstrcpyW
(
domain
,
dm
);
}
if
(((
*
accountSize
!=
0
)
&&
(
*
accountSize
<
ac_len
))
||
((
*
domainSize
!=
0
)
&&
(
*
domainSize
<
dm_len
)))
{
if
((
*
accountSize
&&
*
accountSize
<
ac_len
)
||
(
!
account
&&
!*
accountSize
&&
ac_len
)
||
(
*
domainSize
&&
*
domainSize
<
dm_len
)
||
(
!
domain
&&
!*
domainSize
&&
dm_len
))
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
status
=
FALSE
;
}
...
...
@@ -2238,9 +2246,10 @@ LookupAccountSidW(
*
accountSize
=
ac_len
;
else
*
accountSize
=
ac_len
+
1
;
*
name_use
=
use
;
HeapFree
(
GetProcessHeap
(),
0
,
account_name
);
HeapFree
(
GetProcessHeap
(),
0
,
computer_name
);
if
(
status
)
*
name_use
=
use
;
return
status
;
}
...
...
dlls/advapi32/tests/security.c
View file @
0cffcb77
...
...
@@ -1505,7 +1505,7 @@ static void test_LookupAccountSid(void)
PSID
pUsersSid
=
NULL
;
SID_NAME_USE
use
;
BOOL
ret
;
DWORD
size
,
cbti
=
0
;
DWORD
error
,
size
,
cbti
=
0
;
MAX_SID
max_sid
;
CHAR
*
str_sidA
;
int
i
;
...
...
@@ -1667,6 +1667,16 @@ static void test_LookupAccountSid(void)
"LookupAccountSidW() Expected dom_size = %u, got %u
\n
"
,
real_dom_sizeW
+
1
,
dom_sizeW
);
acc_sizeW
=
dom_sizeW
=
use
=
0
;
SetLastError
(
0xdeadbeef
);
ret
=
LookupAccountSidW
(
NULL
,
pUsersSid
,
NULL
,
&
acc_sizeW
,
NULL
,
&
dom_sizeW
,
&
use
);
error
=
GetLastError
();
ok
(
!
ret
,
"LookupAccountSidW failed %u
\n
"
,
GetLastError
());
ok
(
error
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
error
);
ok
(
acc_sizeW
,
"expected non-zero account size
\n
"
);
ok
(
dom_sizeW
,
"expected non-zero domain size
\n
"
);
ok
(
!
use
,
"expected zero use %u
\n
"
,
use
);
FreeSid
(
pUsersSid
);
/* Test LookupAccountSid with Sid retrieved from token information.
...
...
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