[Python-checkins] CVS: python/dist/src/Python traceback.c,2.32,2.32.6.1

Anthony Baxter anthonybaxter@users.sourceforge.net
Thu, 20 Dec 2001 19:49:34 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv28493

Modified Files:
      Tag: release21-maint
	traceback.c 
Log Message:
backport 2.35:
 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.



Index: traceback.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/traceback.c,v
retrieving revision 2.32
retrieving revision 2.32.6.1
diff -C2 -d -r2.32 -r2.32.6.1
*** traceback.c	2000/09/01 23:29:29	2.32
--- traceback.c	2001/12/21 03:49:31	2.32.6.1
***************
*** 104,108 ****
  	int err = 0;
  	FILE *xfp;
! 	char linebuf[1000];
  	int i;
  	if (filename == NULL || name == NULL)
--- 104,108 ----
  	int err = 0;
  	FILE *xfp;
! 	char linebuf[2000];
  	int i;
  	if (filename == NULL || name == NULL)
***************
*** 110,117 ****
  #ifdef MPW
  	/* This is needed by MPW's File and Line commands */
! #define FMT "  File \"%.900s\"; line %d # in %s\n"
  #else
  	/* This is needed by Emacs' compile command */
! #define FMT "  File \"%.900s\", line %d, in %s\n"
  #endif
  	xfp = fopen(filename, "r");
--- 110,117 ----
  #ifdef MPW
  	/* This is needed by MPW's File and Line commands */
! #define FMT "  File \"%.500s\"; line %d # in %.500s\n"
  #else
  	/* This is needed by Emacs' compile command */
! #define FMT "  File \"%.500s\", line %d, in %.500s\n"
  #endif
  	xfp = fopen(filename, "r");