diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-17 18:05:20 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-17 18:05:20 (GMT) |
commit | 5c1ba53f8ca219a22d964324abb76a055ad19feb (patch) | |
tree | e1778b086fc50fbfd794660240afd6962d3424b7 /Modules | |
parent | 946c19445c902d68ccd75452b97a8098e9b212e5 (diff) | |
download | cpython-5c1ba53f8ca219a22d964324abb76a055ad19feb.zip cpython-5c1ba53f8ca219a22d964324abb76a055ad19feb.tar.gz cpython-5c1ba53f8ca219a22d964324abb76a055ad19feb.tar.bz2 |
Use correct function name to PyArg_ParseTuple("is_package").
Fix off-by-1 error in normalize_line_endings():
when *p == '\0' the NUL was copied into q and q was auto-incremented,
the loop was broken out of,
then a newline was appended followed by a NUL.
So the function, in effect, was strcpy() but added two extra chars
which was caught by obmalloc in debug mode, since there was only
room for 1 additional newline.
Get test working under regrtest (added test_main).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/zipimport.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 159a6b0..4c796f3 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -371,7 +371,7 @@ zipimporter_is_package(PyObject *obj, PyObject *args) char *fullname; enum module_info mi; - if (!PyArg_ParseTuple(args, "s:zipimporter.find_module", + if (!PyArg_ParseTuple(args, "s:zipimporter.is_package", &fullname)) return NULL; @@ -947,7 +947,7 @@ normalize_line_endings(PyObject *source) return NULL; } /* replace "\r\n?" by "\n" */ - for (q = buf;;) { + for (q = buf; *p != '\0'; p++) { if (*p == '\r') { *q++ = '\n'; if (*(p + 1) == '\n') @@ -955,9 +955,6 @@ normalize_line_endings(PyObject *source) } else *q++ = *p; - if (*p == '\0') - break; - p++; } *q++ = '\n'; /* add trailing \n */ *q = '\0'; |