Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
06f9d28d
Commit
06f9d28d
authored
Sep 09, 2016
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #24594: Validates persist parameter when opening MSI database
parent
73fb0bb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
Misc/NEWS
Misc/NEWS
+2
-0
PC/_msi.c
PC/_msi.c
+17
-3
No files found.
Misc/NEWS
View file @
06f9d28d
...
...
@@ -62,6 +62,8 @@ Core and Builtins
Library
-------
-
Issue
#
24594
:
Validates
persist
parameter
when
opening
MSI
database
-
Issue
#
28047
:
Fixed
calculation
of
line
length
used
for
the
base64
CTE
in
the
new
email
policies
.
...
...
PC/_msi.c
View file @
06f9d28d
...
...
@@ -955,6 +955,17 @@ static PyTypeObject msidb_Type = {
0
,
/*tp_is_gc*/
};
#define Py_NOT_PERSIST(x, flag) \
(x != (int)(flag) && \
x != ((int)(flag) | MSIDBOPEN_PATCHFILE))
#define Py_INVALID_PERSIST(x) \
(Py_NOT_PERSIST(x, MSIDBOPEN_READONLY) && \
Py_NOT_PERSIST(x, MSIDBOPEN_TRANSACT) && \
Py_NOT_PERSIST(x, MSIDBOPEN_DIRECT) && \
Py_NOT_PERSIST(x, MSIDBOPEN_CREATE) && \
Py_NOT_PERSIST(x, MSIDBOPEN_CREATEDIRECT))
static
PyObject
*
msiopendb
(
PyObject
*
obj
,
PyObject
*
args
)
{
int
status
;
...
...
@@ -962,11 +973,14 @@ static PyObject* msiopendb(PyObject *obj, PyObject *args)
int
persist
;
MSIHANDLE
h
;
msiobj
*
result
;
if
(
!
PyArg_ParseTuple
(
args
,
"si:MSIOpenDatabase"
,
&
path
,
&
persist
))
return
NULL
;
status
=
MsiOpenDatabase
(
path
,
(
LPCSTR
)
persist
,
&
h
);
/* We need to validate that persist is a valid MSIDBOPEN_* value. Otherwise,
MsiOpenDatabase may treat the value as a pointer, leading to unexpected
behavior. */
if
(
Py_INVALID_PERSIST
(
persist
))
return
msierror
(
ERROR_INVALID_PARAMETER
);
status
=
MsiOpenDatabase
(
path
,
(
LPCSTR
)
persist
,
&
h
);
if
(
status
!=
ERROR_SUCCESS
)
return
msierror
(
status
);
...
...
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