[Python-checkins] r85698 - python/branches/py3k/Modules/zipimport.c
victor.stinner
python-checkins at python.org
Mon Oct 18 22:40:59 CEST 2010
Author: victor.stinner
Date: Mon Oct 18 22:40:59 2010
New Revision: 85698
Log:
zipimport: pass path size to make_filename()
Don't hardcode path size in make_filename().
Modified:
python/branches/py3k/Modules/zipimport.c
Modified: python/branches/py3k/Modules/zipimport.c
==============================================================================
--- python/branches/py3k/Modules/zipimport.c (original)
+++ python/branches/py3k/Modules/zipimport.c Mon Oct 18 22:40:59 2010
@@ -216,7 +216,7 @@
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 @@
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 @@
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 @@
}
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 @@
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;
More information about the Python-checkins
mailing list