Commit 6d20b43a authored by Tim Peters's avatar Tim Peters

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.
parent e2748640
...@@ -274,6 +274,7 @@ Grzegorz Makarewicz ...@@ -274,6 +274,7 @@ Grzegorz Makarewicz
Ken Manheimer Ken Manheimer
Vladimir Marangozov Vladimir Marangozov
Doug Marien Doug Marien
Alex Martelli
Anthony Martin Anthony Martin
Roger Masse Roger Masse
Nick Mathewson Nick Mathewson
......
...@@ -144,16 +144,16 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) ...@@ -144,16 +144,16 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
{ {
int err = 0; int err = 0;
FILE *xfp; FILE *xfp;
char linebuf[1000]; char linebuf[2000];
int i; int i;
if (filename == NULL || name == NULL) if (filename == NULL || name == NULL)
return -1; return -1;
#ifdef MPW #ifdef MPW
/* This is needed by MPW's File and Line commands */ /* 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 #else
/* This is needed by Emacs' compile command */ /* 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 #endif
xfp = fopen(filename, "r"); xfp = fopen(filename, "r");
if (xfp == NULL) { if (xfp == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment