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
7bdf023e
Commit
7bdf023e
authored
May 20, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
May 21, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Validate pointer parameters in MkParseDisplayName.
parent
c4ea80cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
moniker.c
dlls/ole32/moniker.c
+7
-1
moniker.c
dlls/ole32/tests/moniker.c
+41
-0
No files found.
dlls/ole32/moniker.c
View file @
7bdf023e
...
...
@@ -1109,7 +1109,13 @@ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName,
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
pbc
,
debugstr_w
(
szDisplayName
),
pchEaten
,
ppmk
);
if
(
!
(
IsValidInterface
((
LPUNKNOWN
)
pbc
)))
if
(
!
pbc
||
!
IsValidInterface
((
LPUNKNOWN
)
pbc
))
return
E_INVALIDARG
;
if
(
!
szDisplayName
||
!*
szDisplayName
)
return
E_INVALIDARG
;
if
(
!
pchEaten
||
!
ppmk
)
return
E_INVALIDARG
;
*
pchEaten
=
0
;
...
...
dlls/ole32/tests/moniker.c
View file @
7bdf023e
...
...
@@ -814,12 +814,53 @@ static void test_MkParseDisplayName(void)
static
const
WCHAR
wszDisplayNameProgId1
[]
=
{
'S'
,
't'
,
'd'
,
'F'
,
'o'
,
'n'
,
't'
,
':'
,
0
};
static
const
WCHAR
wszDisplayNameProgId2
[]
=
{
'@'
,
'S'
,
't'
,
'd'
,
'F'
,
'o'
,
'n'
,
't'
,
0
};
static
const
WCHAR
wszDisplayNameProgIdFail
[]
=
{
'S'
,
't'
,
'd'
,
'F'
,
'o'
,
'n'
,
't'
,
0
};
static
const
WCHAR
wszEmpty
[]
=
{
0
};
char
szDisplayNameFile
[
256
];
WCHAR
wszDisplayNameFile
[
256
];
int
i
;
const
struct
{
LPBC
*
ppbc
;
LPCOLESTR
szDisplayName
;
LPDWORD
pchEaten
;
LPMONIKER
*
ppmk
;
}
invalid_parameters
[]
=
{
{
NULL
,
NULL
,
NULL
,
NULL
},
{
NULL
,
NULL
,
NULL
,
&
pmk
},
{
NULL
,
NULL
,
&
eaten
,
NULL
},
{
NULL
,
NULL
,
&
eaten
,
&
pmk
},
{
NULL
,
wszEmpty
,
NULL
,
NULL
},
{
NULL
,
wszEmpty
,
NULL
,
&
pmk
},
{
NULL
,
wszEmpty
,
&
eaten
,
NULL
},
{
NULL
,
wszEmpty
,
&
eaten
,
&
pmk
},
{
&
pbc
,
NULL
,
NULL
,
NULL
},
{
&
pbc
,
NULL
,
NULL
,
&
pmk
},
{
&
pbc
,
NULL
,
&
eaten
,
NULL
},
{
&
pbc
,
NULL
,
&
eaten
,
&
pmk
},
{
&
pbc
,
wszEmpty
,
NULL
,
NULL
},
{
&
pbc
,
wszEmpty
,
NULL
,
&
pmk
},
{
&
pbc
,
wszEmpty
,
&
eaten
,
NULL
},
{
&
pbc
,
wszEmpty
,
&
eaten
,
&
pmk
},
};
hr
=
CreateBindCtx
(
0
,
&
pbc
);
ok_ole_success
(
hr
,
CreateBindCtx
);
for
(
i
=
0
;
i
<
sizeof
(
invalid_parameters
)
/
sizeof
(
invalid_parameters
[
0
]);
i
++
)
{
eaten
=
0xdeadbeef
;
pmk
=
(
IMoniker
*
)
0xdeadbeef
;
hr
=
MkParseDisplayName
(
invalid_parameters
[
i
].
ppbc
?
*
invalid_parameters
[
i
].
ppbc
:
NULL
,
invalid_parameters
[
i
].
szDisplayName
,
invalid_parameters
[
i
].
pchEaten
,
invalid_parameters
[
i
].
ppmk
);
ok
(
hr
==
E_INVALIDARG
,
"[%d] MkParseDisplayName should have failed with E_INVALIDARG instead of 0x%08x
\n
"
,
i
,
hr
);
ok
(
eaten
==
0xdeadbeef
,
"[%d] Processed character count should have been 0xdeadbeef instead of %u
\n
"
,
i
,
eaten
);
ok
(
pmk
==
(
IMoniker
*
)
0xdeadbeef
,
"[%d] Output moniker pointer should have been 0xdeadbeef instead of %p
\n
"
,
i
,
pmk
);
}
hr
=
MkParseDisplayName
(
pbc
,
wszNonExistentProgId
,
&
eaten
,
&
pmk
);
ok
(
hr
==
MK_E_SYNTAX
||
hr
==
MK_E_CANTOPENFILE
/* Win9x */
,
"MkParseDisplayName should have failed with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%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