Mercurial > cpython-lru_cache-weakref
diff Python/traceback.c @ 21057:2c0a9a5086e1 legacy-trunk
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.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Tue, 27 Nov 2001 20:30:42 +0000 |
| parents | 4fb7727e4f47 |
| children | 379fc66f4c96 |
line wrap: on
line diff
--- a/Python/traceback.c Tue Nov 27 07:12:35 2001 +0000 +++ b/Python/traceback.c Tue Nov 27 20:30:42 2001 +0000 @@ -144,16 +144,16 @@ { 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) {
