diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-11-27 20:30:42 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-11-27 20:30:42 (GMT) |
commit | 6d20b43a4e3255e4b4fe4468861abf72166d9acf (patch) | |
tree | 51a1700f66bc49fbd88c066beedfbe31af679505 | |
parent | e274864004995f7b8b80abe1cea61b5ec8111ad7 (diff) | |
download | cpython-6d20b43a4e3255e4b4fe4468861abf72166d9acf.zip cpython-6d20b43a4e3255e4b4fe4468861abf72166d9acf.tar.gz cpython-6d20b43a4e3255e4b4fe4468861abf72166d9acf.tar.bz2 |
SF bug 485175: buffer overflow in traceback.c.
Bugfix candidate.
tb_displayline(): the sprintf format was choking off the file name, but
used plain %s for the function name (which can be arbitrarily long).
Limit both to 500 chars max.
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Python/traceback.c | 6 |
2 files changed, 4 insertions, 3 deletions
@@ -274,6 +274,7 @@ Grzegorz Makarewicz Ken Manheimer Vladimir Marangozov Doug Marien +Alex Martelli Anthony Martin Roger Masse Nick Mathewson diff --git a/Python/traceback.c b/Python/traceback.c index 7bbf852..6abde64 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -144,16 +144,16 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) { int err = 0; FILE *xfp; - char linebuf[1000]; + char linebuf[2000]; int i; if (filename == NULL || name == NULL) return -1; #ifdef MPW /* This is needed by MPW's File and Line commands */ -#define FMT " File \"%.900s\"; line %d # in %s\n" +#define FMT " File \"%.500s\"; line %d # in %.500s\n" #else /* This is needed by Emacs' compile command */ -#define FMT " File \"%.900s\", line %d, in %s\n" +#define FMT " File \"%.500s\", line %d, in %.500s\n" #endif xfp = fopen(filename, "r"); if (xfp == NULL) { |