diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-11-27 20:30:42 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-11-27 20:30:42 +0000 |
commit | e5199d5eb436fd06dabfa27a0aff2b82ac829a74 (patch) | |
tree | e2c7fb8737581822a0ff4d921b274f4110dd7e08 /Python/traceback.c | |
parent | d2547c0bf513a9833908b1f17d89924b55875361 (diff) | |
download | cpython-e5199d5eb436fd06dabfa27a0aff2b82ac829a74.tar.gz |
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.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r-- | Python/traceback.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index 7bbf852cdc..6abde64de6 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) { |