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
b56ed222
Commit
b56ed222
authored
Dec 21, 2005
by
Bill Medland
Committed by
Alexandre Julliard
Dec 21, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Prevent array underflow in MsiFormat when measuring with zero-length buffer.
parent
bad4a1dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
format.c
dlls/msi/format.c
+7
-1
format.c
dlls/msi/tests/format.c
+6
-1
No files found.
dlls/msi/format.c
View file @
b56ed222
...
...
@@ -639,10 +639,15 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer,
len
=
deformat_string_internal
(
package
,
rec
,
&
deformated
,
strlenW
(
rec
),
record
,
NULL
);
/* If len is zero then WideCharToMultiByte will return 0 indicating
* failure, but that will do just as well since we are ignoring
* possible errors.
*/
lenA
=
WideCharToMultiByte
(
CP_ACP
,
0
,
deformated
,
len
,
NULL
,
0
,
NULL
,
NULL
);
if
(
buffer
)
{
/* Ditto above */
WideCharToMultiByte
(
CP_ACP
,
0
,
deformated
,
len
,
buffer
,
*
size
,
NULL
,
NULL
);
if
(
*
size
>
lenA
)
{
...
...
@@ -652,7 +657,8 @@ UINT MSI_FormatRecordA( MSIPACKAGE* package, MSIRECORD* record, LPSTR buffer,
else
{
rc
=
ERROR_MORE_DATA
;
buffer
[(
*
size
)
-
1
]
=
0
;
if
(
*
size
)
buffer
[(
*
size
)
-
1
]
=
0
;
}
}
else
...
...
dlls/msi/tests/format.c
View file @
b56ed222
...
...
@@ -109,7 +109,7 @@ static void test_formatrecord(void)
char
buffer
[
100
];
MSIHANDLE
hrec
;
UINT
r
;
DWORD
sz
=
100
;
DWORD
sz
;
r
=
MsiFormatRecord
(
0
,
0
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"wrong error
\n
"
);
...
...
@@ -122,6 +122,11 @@ static void test_formatrecord(void)
ok
(
r
==
ERROR_SUCCESS
,
"format failed
\n
"
);
buffer
[
0
]
=
'x'
;
buffer
[
1
]
=
0
;
sz
=
0
;
r
=
MsiFormatRecord
(
0
,
hrec
,
buffer
+
1
,
&
sz
);
ok
(
r
==
ERROR_MORE_DATA
&&
buffer
[
0
]
==
'x'
,
"format failed measuring with buffer
\n
"
);
ok
(
sz
==
16
,
"size wrong
\n
"
);
sz
=
100
;
r
=
MsiFormatRecord
(
0
,
hrec
,
buffer
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"format failed with empty buffer
\n
"
);
ok
(
sz
==
16
,
"size wrong
\n
"
);
...
...
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