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
5c63332b
Commit
5c63332b
authored
Nov 09, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Nov 09, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix passing of NULL pointers to MsiDecomposeDescriptor and add a
test.
parent
454fa4be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
21 deletions
+53
-21
registry.c
dlls/msi/registry.c
+27
-15
db.c
dlls/msi/tests/db.c
+26
-6
No files found.
dlls/msi/registry.c
View file @
5c63332b
...
@@ -253,6 +253,9 @@ BOOL decode_base85_guid( LPCWSTR str, GUID *guid )
...
@@ -253,6 +253,9 @@ BOOL decode_base85_guid( LPCWSTR str, GUID *guid )
{
{
DWORD
i
,
val
=
0
,
base
=
1
,
*
p
;
DWORD
i
,
val
=
0
,
base
=
1
,
*
p
;
if
(
!
str
)
return
FALSE
;
p
=
(
DWORD
*
)
guid
;
p
=
(
DWORD
*
)
guid
;
for
(
i
=
0
;
i
<
20
;
i
++
)
for
(
i
=
0
;
i
<
20
;
i
++
)
{
{
...
@@ -532,8 +535,11 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
...
@@ -532,8 +535,11 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
len
=
(
p
-
&
szDescriptor
[
20
]);
len
=
(
p
-
&
szDescriptor
[
20
]);
if
(
len
>
MAX_FEATURE_CHARS
)
if
(
len
>
MAX_FEATURE_CHARS
)
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
memcpy
(
szFeature
,
&
szDescriptor
[
20
],
len
*
sizeof
(
WCHAR
)
);
if
(
szFeature
)
szFeature
[
len
]
=
0
;
{
memcpy
(
szFeature
,
&
szDescriptor
[
20
],
len
*
sizeof
(
WCHAR
)
);
szFeature
[
len
]
=
0
;
}
TRACE
(
"feature %s
\n
"
,
debugstr_w
(
szFeature
));
TRACE
(
"feature %s
\n
"
,
debugstr_w
(
szFeature
));
...
@@ -543,8 +549,10 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
...
@@ -543,8 +549,10 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct,
TRACE
(
"component %s
\n
"
,
debugstr_guid
(
&
component
));
TRACE
(
"component %s
\n
"
,
debugstr_guid
(
&
component
));
StringFromGUID2
(
&
product
,
szProduct
,
MAX_FEATURE_CHARS
+
1
);
if
(
szProduct
)
StringFromGUID2
(
&
component
,
szComponent
,
MAX_FEATURE_CHARS
+
1
);
StringFromGUID2
(
&
product
,
szProduct
,
MAX_FEATURE_CHARS
+
1
);
if
(
szComponent
)
StringFromGUID2
(
&
component
,
szComponent
,
MAX_FEATURE_CHARS
+
1
);
len
=
(
&
p
[
21
]
-
szDescriptor
);
len
=
(
&
p
[
21
]
-
szDescriptor
);
TRACE
(
"length = %d
\n
"
,
len
);
TRACE
(
"length = %d
\n
"
,
len
);
...
@@ -559,26 +567,30 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
...
@@ -559,26 +567,30 @@ UINT WINAPI MsiDecomposeDescriptorA( LPCSTR szDescriptor, LPSTR szProduct,
WCHAR
product
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
product
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
feature
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
feature
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
component
[
MAX_FEATURE_CHARS
+
1
];
WCHAR
component
[
MAX_FEATURE_CHARS
+
1
];
LPWSTR
str
=
NULL
;
LPWSTR
str
=
NULL
,
p
=
NULL
,
f
=
NULL
,
c
=
NULL
;
UINT
r
;
UINT
r
;
TRACE
(
"%s %p %p %p %p
\n
"
,
debugstr_a
(
szDescriptor
),
szProduct
,
TRACE
(
"%s %p %p %p %p
\n
"
,
debugstr_a
(
szDescriptor
),
szProduct
,
szFeature
,
szComponent
,
pUsed
);
szFeature
,
szComponent
,
pUsed
);
if
(
szDescriptor
)
str
=
strdupAtoW
(
szDescriptor
);
{
if
(
szDescriptor
&&
!
str
)
str
=
strdupAtoW
(
szDescriptor
);
return
ERROR_OUTOFMEMORY
;
if
(
!
str
)
return
ERROR_OUTOFMEMORY
;
if
(
szProduct
)
}
p
=
product
;
if
(
szFeature
)
f
=
feature
;
if
(
szComponent
)
c
=
component
;
r
=
MsiDecomposeDescriptorW
(
str
,
p
roduct
,
feature
,
component
,
pUsed
);
r
=
MsiDecomposeDescriptorW
(
str
,
p
,
f
,
c
,
pUsed
);
WideCharToMultiByte
(
CP_ACP
,
0
,
p
roduct
,
MAX_FEATURE_CHARS
+
1
,
WideCharToMultiByte
(
CP_ACP
,
0
,
p
,
MAX_FEATURE_CHARS
+
1
,
szProduct
,
MAX_FEATURE_CHARS
+
1
,
NULL
,
NULL
);
szProduct
,
MAX_FEATURE_CHARS
+
1
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
f
eature
,
MAX_FEATURE_CHARS
+
1
,
WideCharToMultiByte
(
CP_ACP
,
0
,
f
,
MAX_FEATURE_CHARS
+
1
,
szFeature
,
MAX_FEATURE_CHARS
+
1
,
NULL
,
NULL
);
szFeature
,
MAX_FEATURE_CHARS
+
1
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
c
omponent
,
MAX_FEATURE_CHARS
+
1
,
WideCharToMultiByte
(
CP_ACP
,
0
,
c
,
MAX_FEATURE_CHARS
+
1
,
szComponent
,
MAX_FEATURE_CHARS
+
1
,
NULL
,
NULL
);
szComponent
,
MAX_FEATURE_CHARS
+
1
,
NULL
,
NULL
);
msi_free
(
str
);
msi_free
(
str
);
...
...
dlls/msi/tests/db.c
View file @
5c63332b
...
@@ -128,7 +128,7 @@ static void test_msiinsert(void)
...
@@ -128,7 +128,7 @@ static void test_msiinsert(void)
}
}
typedef
UINT
(
WINAPI
*
fnMsiDecomposeDescriptorA
)(
LPCSTR
,
LPCSTR
,
LPSTR
,
LPSTR
,
DWORD
*
);
typedef
UINT
(
WINAPI
*
fnMsiDecomposeDescriptorA
)(
LPCSTR
,
LPCSTR
,
LPSTR
,
LPSTR
,
DWORD
*
);
fnMsiDecomposeDescriptorA
MsiDecomposeDescriptorA
;
static
fnMsiDecomposeDescriptorA
p
MsiDecomposeDescriptorA
;
static
void
test_msidecomposedesc
(
void
)
static
void
test_msidecomposedesc
(
void
)
{
{
...
@@ -141,15 +141,15 @@ static void test_msidecomposedesc(void)
...
@@ -141,15 +141,15 @@ static void test_msidecomposedesc(void)
hmod
=
GetModuleHandle
(
"msi.dll"
);
hmod
=
GetModuleHandle
(
"msi.dll"
);
if
(
!
hmod
)
if
(
!
hmod
)
return
;
return
;
MsiDecomposeDescriptorA
=
(
fnMsiDecomposeDescriptorA
)
p
MsiDecomposeDescriptorA
=
(
fnMsiDecomposeDescriptorA
)
GetProcAddress
(
hmod
,
"MsiDecomposeDescriptorA"
);
GetProcAddress
(
hmod
,
"MsiDecomposeDescriptorA"
);
if
(
!
MsiDecomposeDescriptorA
)
if
(
!
p
MsiDecomposeDescriptorA
)
return
;
return
;
/* test a valid feature descriptor */
/* test a valid feature descriptor */
desc
=
"']gAVn-}f(ZXfeAR6.jiFollowTheWhiteRabbit>3w2x^IGfe?CxI5heAvk."
;
desc
=
"']gAVn-}f(ZXfeAR6.jiFollowTheWhiteRabbit>3w2x^IGfe?CxI5heAvk."
;
len
=
0
;
len
=
0
;
r
=
MsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
comp
,
&
len
);
r
=
p
MsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
comp
,
&
len
);
ok
(
r
==
ERROR_SUCCESS
,
"returned an error
\n
"
);
ok
(
r
==
ERROR_SUCCESS
,
"returned an error
\n
"
);
ok
(
len
==
strlen
(
desc
),
"length was wrong
\n
"
);
ok
(
len
==
strlen
(
desc
),
"length was wrong
\n
"
);
ok
(
strcmp
(
prod
,
"{90110409-6000-11D3-8CFE-0150048383C9}"
)
==
0
,
"product wrong
\n
"
);
ok
(
strcmp
(
prod
,
"{90110409-6000-11D3-8CFE-0150048383C9}"
)
==
0
,
"product wrong
\n
"
);
...
@@ -161,7 +161,7 @@ static void test_msidecomposedesc(void)
...
@@ -161,7 +161,7 @@ static void test_msidecomposedesc(void)
"ThisWillFailIfTheresMoreThanAGuidsChars>"
"ThisWillFailIfTheresMoreThanAGuidsChars>"
"3w2x^IGfe?CxI5heAvk."
;
"3w2x^IGfe?CxI5heAvk."
;
len
=
0
;
len
=
0
;
r
=
MsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
comp
,
&
len
);
r
=
p
MsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
comp
,
&
len
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"returned wrong error
\n
"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"returned wrong error
\n
"
);
/*
/*
...
@@ -173,9 +173,29 @@ static void test_msidecomposedesc(void)
...
@@ -173,9 +173,29 @@ static void test_msidecomposedesc(void)
"3w2x^IGfe?CxI5heAvk."
"3w2x^IGfe?CxI5heAvk."
"extra"
;
"extra"
;
len
=
0
;
len
=
0
;
r
=
MsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
comp
,
&
len
);
r
=
p
MsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
comp
,
&
len
);
ok
(
r
==
ERROR_SUCCESS
,
"returned wrong error
\n
"
);
ok
(
r
==
ERROR_SUCCESS
,
"returned wrong error
\n
"
);
ok
(
len
==
(
strlen
(
desc
)
-
strlen
(
"extra"
)),
"length wrong
\n
"
);
ok
(
len
==
(
strlen
(
desc
)
-
strlen
(
"extra"
)),
"length wrong
\n
"
);
len
=
0
;
r
=
pMsiDecomposeDescriptorA
(
desc
,
prod
,
feature
,
NULL
,
&
len
);
ok
(
r
==
ERROR_SUCCESS
,
"returned wrong error
\n
"
);
ok
(
len
==
(
strlen
(
desc
)
-
strlen
(
"extra"
)),
"length wrong
\n
"
);
len
=
0
;
r
=
pMsiDecomposeDescriptorA
(
desc
,
prod
,
NULL
,
NULL
,
&
len
);
ok
(
r
==
ERROR_SUCCESS
,
"returned wrong error
\n
"
);
ok
(
len
==
(
strlen
(
desc
)
-
strlen
(
"extra"
)),
"length wrong
\n
"
);
len
=
0
;
r
=
pMsiDecomposeDescriptorA
(
desc
,
NULL
,
NULL
,
NULL
,
&
len
);
ok
(
r
==
ERROR_SUCCESS
,
"returned wrong error
\n
"
);
ok
(
len
==
(
strlen
(
desc
)
-
strlen
(
"extra"
)),
"length wrong
\n
"
);
len
=
0
;
r
=
pMsiDecomposeDescriptorA
(
NULL
,
NULL
,
NULL
,
NULL
,
&
len
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"returned wrong error
\n
"
);
ok
(
len
==
0
,
"length wrong
\n
"
);
}
}
static
UINT
try_query_param
(
MSIHANDLE
hdb
,
LPCSTR
szQuery
,
MSIHANDLE
hrec
)
static
UINT
try_query_param
(
MSIHANDLE
hdb
,
LPCSTR
szQuery
,
MSIHANDLE
hrec
)
...
...
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