[PD-cvs] pd/src s_main.c,1.28.6.6,1.28.6.7

Russell Bryant russellbryant at users.sourceforge.net
Sun Jan 6 05:34:17 CET 2008


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24552

Modified Files:
      Tag: branch-v0-40-extended
	s_main.c 
Log Message:
Simplify pd_makeversion(), and make it safe from a potential stack buffer overflow
if the version string was really long.
(from issue #1836228)


Index: s_main.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_main.c,v
retrieving revision 1.28.6.6
retrieving revision 1.28.6.7
diff -C2 -d -r1.28.6.6 -r1.28.6.7
*** s_main.c	6 Jan 2008 04:19:15 -0000	1.28.6.6
--- s_main.c	6 Jan 2008 04:34:15 -0000	1.28.6.7
***************
*** 250,257 ****
  {
      char foo[100];
!     sprintf(foo,  "Pd version %d.%d-%d%s\n",PD_MAJOR_VERSION,
!         PD_MINOR_VERSION,PD_BUGFIX_VERSION,PD_TEST_VERSION);
!     pd_version = malloc(strlen(foo)+1);
!     strcpy(pd_version, foo);
  }
  
--- 250,258 ----
  {
      char foo[100];
! 
!     snprintf(foo, sizeof(foo), "Pd version %d.%d-%d%s\n", PD_MAJOR_VERSION,
!         PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION);
! 	
!     pd_version = strdup(foo);
  }
  





More information about the Pd-cvs mailing list