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
aff9f4c1
Commit
aff9f4c1
authored
Jul 26, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Jul 26, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Fix an off by one error in MsiRecordGetString.
parent
76baa45a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
record.c
dlls/msi/record.c
+2
-2
record.c
dlls/msi/tests/record.c
+38
-0
No files found.
dlls/msi/record.c
View file @
aff9f4c1
...
...
@@ -321,7 +321,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, unsigned int iField,
break
;
}
if
(
*
pcchValue
<
len
)
if
(
*
pcchValue
<
=
len
)
ret
=
ERROR_MORE_DATA
;
*
pcchValue
=
len
;
...
...
@@ -389,7 +389,7 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec, unsigned int iField,
break
;
}
if
(
*
pcchValue
<
len
)
if
(
*
pcchValue
<
=
len
)
ret
=
ERROR_MORE_DATA
;
*
pcchValue
=
len
;
...
...
dlls/msi/tests/record.c
View file @
aff9f4c1
...
...
@@ -51,7 +51,9 @@ static void test_msirecord(void)
INT
i
;
MSIHANDLE
h
;
char
buf
[
10
];
WCHAR
bufW
[
10
];
const
char
str
[]
=
"hello"
;
const
WCHAR
strW
[]
=
{
'h'
,
'e'
,
'l'
,
'l'
,
'o'
,
0
};
char
filename
[
MAX_PATH
];
/* check behaviour with an invalid record */
...
...
@@ -147,6 +149,42 @@ static void test_msirecord(void)
ok
(
0
==
strncmp
(
buf
,
str
,
sizeof
str
-
3
),
"MsiRecordGetString returned the wrong string
\n
"
);
ok
(
buf
[
sizeof
str
-
3
]
==
0
,
"string wasn't nul terminated
\n
"
);
buf
[
0
]
=
0
;
sz
=
sizeof
str
;
r
=
MsiRecordGetString
(
h
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"wrong error
\n
"
);
ok
(
sz
==
sizeof
str
-
1
,
"MsiRecordGetString returned the wrong length
\n
"
);
ok
(
0
==
strcmp
(
buf
,
str
),
"MsiRecordGetString returned the wrong string
\n
"
);
memset
(
bufW
,
0
,
sizeof
bufW
);
sz
=
5
;
r
=
MsiRecordGetStringW
(
h
,
0
,
bufW
,
&
sz
);
ok
(
r
==
ERROR_MORE_DATA
,
"wrong error
\n
"
);
ok
(
sz
==
5
,
"MsiRecordGetString returned the wrong length
\n
"
);
ok
(
0
==
memcmp
(
bufW
,
strW
,
8
),
"MsiRecordGetString returned the wrong string
\n
"
);
sz
=
0
;
bufW
[
0
]
=
'x'
;
r
=
MsiRecordGetStringW
(
h
,
0
,
bufW
,
&
sz
);
ok
(
r
==
ERROR_MORE_DATA
,
"wrong error
\n
"
);
ok
(
sz
==
5
,
"MsiRecordGetString returned the wrong length
\n
"
);
ok
(
'x'
==
bufW
[
0
],
"MsiRecordGetString returned the wrong string
\n
"
);
memset
(
buf
,
0
,
sizeof
buf
);
sz
=
5
;
r
=
MsiRecordGetStringA
(
h
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_MORE_DATA
,
"wrong error
\n
"
);
ok
(
sz
==
5
,
"MsiRecordGetString returned the wrong length
\n
"
);
ok
(
0
==
memcmp
(
buf
,
str
,
4
),
"MsiRecordGetString returned the wrong string
\n
"
);
sz
=
0
;
buf
[
0
]
=
'x'
;
r
=
MsiRecordGetStringA
(
h
,
0
,
buf
,
&
sz
);
ok
(
r
==
ERROR_MORE_DATA
,
"wrong error
\n
"
);
ok
(
sz
==
5
,
"MsiRecordGetString returned the wrong length
\n
"
);
ok
(
'x'
==
buf
[
0
],
"MsiRecordGetString returned the wrong string
\n
"
);
/* same record, check we can wipe all the data */
r
=
MsiRecordClearData
(
h
);
ok
(
r
==
ERROR_SUCCESS
,
"Failed to clear record
\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