You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by ka...@apache.org on 2004/09/16 03:42:55 UTC

cvs commit: tcl-rivet/src parserPkgInit.c

karl        2004/09/15 18:42:55

  Modified:    .        ChangeLog
               src      parserPkgInit.c
  Log:
  Added a Rivetparser_SafeInit to parserPkgInit.c so the C-based parser package
  can be used from safe interpreters.
  
  Revision  Changes    Path
  1.192     +8 -2      tcl-rivet/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/ChangeLog,v
  retrieving revision 1.191
  retrieving revision 1.192
  diff -u -r1.191 -r1.192
  --- ChangeLog	16 Sep 2004 01:25:38 -0000	1.191
  +++ ChangeLog	16 Sep 2004 01:42:54 -0000	1.192
  @@ -1,4 +1,12 @@
   2004-09-16  Karl Lehenbauer  <ka...@sc.com>
  +	* src/parserPkgInit.c: Added a Rivetparser_SafeInit so the
  +	C-based standalone Rivet parser library can be loaded
  +	from safe interpreters.  After inspection, we believe that
  +	rivet::parserivetdata can be loaded into safe interpreters
  +	without compromising their security.  rivet::parserivet
  +	definitely cannot be made available to a safe interpreter --
  +	it could be manipulated to read files.
  +
   	* src/rivetPkgInit.c: Added a Rivet_SafeInit so lib can
   	be loaded from safe interpreters, which also makes it work
   	better under Mac OS X.
  @@ -8,8 +16,6 @@
   	* src/rivetWWW.c: (same)
   
   	* README.MacOSX: Temporary file to document Mac OS X build quirks.
  -
  -2004-09-16  Karl Lehenbauer  <ka...@sc.com>
   
   	* src/configure.tcl: If a configuration variable in
   	  tclConfig.sh ever had an equal sign in the "value"
  
  
  
  1.6       +23 -1     tcl-rivet/src/parserPkgInit.c
  
  Index: parserPkgInit.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/parserPkgInit.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- parserPkgInit.c	24 Feb 2004 10:24:34 -0000	1.5
  +++ parserPkgInit.c	16 Sep 2004 01:42:55 -0000	1.6
  @@ -126,3 +126,25 @@
   
       return Tcl_PkgProvide( interp, "rivetparser", "0.2" );
   }
  +
  +EXTERN int
  +Rivetparser_SafeInit( Tcl_Interp *interp )
  +{
  +    /* rivet::parserivet is DEFINITELY unsafe -- it takes a filename,
  +     * and code in safe interpreters could possibly manipulate it
  +     * to read files */
  +
  +    /* but after inspect we find that rivet::parserivetdata appears
  +     * to be safe -- it reads a string and returns a new string derived
  +     * from the string it read, using Tcl C calls to construct the
  +     * target string, which should by design prevent buffer overflow
  +     * attacks, etc.
  +     */
  +    Tcl_CreateObjCommand(interp,
  +			 "rivet::parserivetdata",
  +			 Parse_RivetData,
  +			 NULL,
  +			 (Tcl_CmdDeleteProc *)NULL);
  +
  +    return Tcl_PkgProvide( interp, "rivetparser", "0.2" );
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org