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
2eda884b
Commit
2eda884b
authored
Apr 10, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fusion: Fix insufficient buffer size handling in IAssemblyName::GetDisplayName.
parent
382b72d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
asmname.c
dlls/fusion/asmname.c
+10
-6
asmname.c
dlls/fusion/tests/asmname.c
+17
-0
No files found.
dlls/fusion/asmname.c
View file @
2eda884b
...
...
@@ -228,12 +228,10 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
LPDWORD
pccDisplayName
,
DWORD
dwDisplayFlags
)
{
static
const
WCHAR
equals
[]
=
{
'='
,
0
};
IAssemblyNameImpl
*
name
=
impl_from_IAssemblyName
(
iface
);
WCHAR
verstr
[
30
];
WCHAR
verstr
[
30
]
,
*
cultureval
=
NULL
;
DWORD
size
;
LPWSTR
cultureval
=
0
;
static
const
WCHAR
equals
[]
=
{
'='
,
0
};
TRACE
(
"(%p, %p, %p, %d)
\n
"
,
iface
,
szDisplayName
,
pccDisplayName
,
dwDisplayFlags
);
...
...
@@ -243,9 +241,15 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
if
(
!
name
->
displayname
||
!*
name
->
displayname
)
return
FUSION_E_INVALID_NAME
;
size
=
min
(
*
pccDisplayName
,
lstrlenW
(
name
->
displayname
)
+
1
);
size
=
strlenW
(
name
->
displayname
)
+
1
;
if
(
*
pccDisplayName
<
size
)
{
*
pccDisplayName
=
size
;
return
E_NOT_SUFFICIENT_BUFFER
;
}
lstrcpynW
(
szDisplayName
,
name
->
displayname
,
siz
e
);
if
(
szDisplayName
)
strcpyW
(
szDisplayName
,
name
->
displaynam
e
);
*
pccDisplayName
=
size
;
return
S_OK
;
...
...
dlls/fusion/tests/asmname.c
View file @
2eda884b
...
...
@@ -508,6 +508,23 @@ static void test_CreateAssemblyNameObject(void)
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
ok
(
name
!=
NULL
,
"Expected non-NULL name
\n
"
);
size
=
0
;
hr
=
IAssemblyName_GetDisplayName
(
name
,
NULL
,
&
size
,
0
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"got %08x
\n
"
,
hr
);
ok
(
size
==
5
,
"got %u
\n
"
,
size
);
size
=
3
;
hr
=
IAssemblyName_GetDisplayName
(
name
,
NULL
,
&
size
,
0
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
||
broken
(
hr
==
E_INVALIDARG
),
"got %08x
\n
"
,
hr
);
ok
(
size
==
5
||
broken
(
size
==
3
),
"got %u
\n
"
,
size
);
size
=
3
;
str
[
0
]
=
'a'
;
hr
=
IAssemblyName_GetDisplayName
(
name
,
str
,
&
size
,
0
);
ok
(
hr
==
E_NOT_SUFFICIENT_BUFFER
,
"got %08x
\n
"
,
hr
);
ok
(
str
[
0
]
==
'a'
,
"got %c
\n
"
,
str
[
0
]);
ok
(
size
==
5
,
"got %u
\n
"
,
size
);
size
=
MAX_PATH
;
hr
=
IAssemblyName_GetDisplayName
(
name
,
str
,
&
size
,
ASM_DISPLAYF_FULL
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
...
...
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