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
05072045
Commit
05072045
authored
Oct 18, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zipimport: pass path size to make_filename()
Don't hardcode path size in make_filename().
parent
edc35f08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Modules/zipimport.c
Modules/zipimport.c
+5
-5
No files found.
Modules/zipimport.c
View file @
05072045
...
...
@@ -216,7 +216,7 @@ get_subname(char *fullname)
archive (without extension) to the path buffer. Return the
length of the resulting string. */
static
int
make_filename
(
PyObject
*
prefix_obj
,
char
*
name
,
char
*
path
)
make_filename
(
PyObject
*
prefix_obj
,
char
*
name
,
char
*
path
,
size_t
pathsize
)
{
size_t
len
;
char
*
p
;
...
...
@@ -228,7 +228,7 @@ make_filename(PyObject *prefix_obj, char *name, char *path)
len
=
PyBytes_GET_SIZE
(
prefix
);
/* self.prefix + name [+ SEP + "__init__"] + ".py[co]" */
if
(
len
+
strlen
(
name
)
+
13
>=
MAXPATHLEN
)
{
if
(
len
+
strlen
(
name
)
+
13
>=
pathsize
-
1
)
{
PyErr_SetString
(
ZipImportError
,
"path too long"
);
Py_DECREF
(
prefix
);
return
-
1
;
...
...
@@ -263,7 +263,7 @@ get_module_info(ZipImporter *self, char *fullname)
subname
=
get_subname
(
fullname
);
len
=
make_filename
(
self
->
prefix
,
subname
,
path
);
len
=
make_filename
(
self
->
prefix
,
subname
,
path
,
sizeof
(
path
)
);
if
(
len
<
0
)
return
MI_ERROR
;
...
...
@@ -507,7 +507,7 @@ zipimporter_get_source(PyObject *obj, PyObject *args)
}
subname
=
get_subname
(
fullname
);
len
=
make_filename
(
self
->
prefix
,
subname
,
path
);
len
=
make_filename
(
self
->
prefix
,
subname
,
path
,
sizeof
(
path
)
);
if
(
len
<
0
)
return
NULL
;
...
...
@@ -1171,7 +1171,7 @@ get_module_code(ZipImporter *self, char *fullname,
subname
=
get_subname
(
fullname
);
len
=
make_filename
(
self
->
prefix
,
subname
,
path
);
len
=
make_filename
(
self
->
prefix
,
subname
,
path
,
sizeof
(
path
)
);
if
(
len
<
0
)
return
NULL
;
...
...
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