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
533833b4
Commit
533833b4
authored
Aug 31, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Sep 07, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Validate database fields before inserting them.
parent
71d8f4eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
table.c
dlls/msi/table.c
+35
-4
db.c
dlls/msi/tests/db.c
+1
-4
No files found.
dlls/msi/table.c
View file @
533833b4
...
...
@@ -1302,12 +1302,38 @@ static UINT msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row );
static
UINT
table_validate_new
(
MSITABLEVIEW
*
tv
,
MSIRECORD
*
rec
)
{
UINT
r
,
row
;
UINT
r
,
row
,
i
;
/* check there's no null values where they're not allowed */
for
(
i
=
0
;
i
<
tv
->
num_cols
;
i
++
)
{
if
(
tv
->
columns
[
i
].
type
&
MSITYPE_NULLABLE
)
continue
;
if
(
tv
->
columns
[
i
].
type
&
MSITYPE_STRING
)
{
LPCWSTR
str
;
str
=
MSI_RecordGetString
(
rec
,
i
+
1
);
if
(
str
==
NULL
||
str
[
0
]
==
0
)
return
ERROR_INVALID_DATA
;
}
else
{
UINT
n
;
n
=
MSI_RecordGetInteger
(
rec
,
i
+
1
);
if
(
n
==
MSI_NULL_INTEGER
)
return
ERROR_INVALID_DATA
;
}
}
/* check there's no duplicate keys */
r
=
msi_table_find_row
(
tv
,
rec
,
&
row
);
if
(
r
!=
ERROR_SUCCESS
)
return
ERROR_SUCCESS
;
return
ERROR_INVALID_DATA
;
if
(
r
==
ERROR_SUCCESS
)
return
ERROR_INVALID_DATA
;
return
ERROR_SUCCESS
;
}
static
UINT
msi_table_modify_row
(
MSITABLEVIEW
*
tv
,
MSIRECORD
*
rec
,
...
...
@@ -1352,6 +1378,11 @@ static UINT TABLE_insert_row( struct tagMSIVIEW *view, MSIRECORD *rec )
TRACE
(
"%p %p
\n
"
,
tv
,
rec
);
/* check that the key is unique - can we find a matching row? */
r
=
table_validate_new
(
tv
,
rec
);
if
(
r
!=
ERROR_SUCCESS
)
return
ERROR_FUNCTION_FAILED
;
r
=
table_create_new_row
(
view
,
&
row
);
TRACE
(
"insert_row returned %08x
\n
"
,
r
);
if
(
r
!=
ERROR_SUCCESS
)
...
...
dlls/msi/tests/db.c
View file @
533833b4
...
...
@@ -1323,10 +1323,7 @@ static void test_markers(void)
MsiRecordSetString
(
rec
,
3
,
"haha"
);
query
=
"INSERT INTO `?` ( `One`, `Two` ) VALUES ( ?, '?' )"
;
r
=
run_query
(
hdb
,
rec
,
query
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %d
\n
"
,
r
);
/* try all markers */
MsiCloseHandle
(
rec
);
...
...
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