From: Andrew M. <fit...@us...> - 2006-04-12 19:25:02
|
Update of /cvsroot/radmind/radmind-assistant/rte In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29682 Modified Files: code.c code.h Log Message: Current version of encode/decode. Index: code.c =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/code.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** code.c 19 May 2005 00:10:54 -0000 1.3 --- code.c 12 Apr 2006 19:24:56 -0000 1.4 *************** *** 1,31 **** /* ! Copyright (c) 2002 Regents of The University of Michigan. ! All Rights Reserved. ! ! Permission to use, copy, modify, and distribute this software and ! its documentation for any purpose and without fee is hereby granted, ! provided that the above copyright notice appears in all copies and ! that both that copyright notice and this permission notice appear ! in supporting documentation, and that the name of The University ! of Michigan not be used in advertising or publicity pertaining to ! distribution of the software without specific, written prior ! permission. This software is supplied as is without expressed or ! implied warranties of any kind. ! ! Research Systems Unix Group ! The University of Michigan ! c/o Wesley Craig ! 4251 Plymouth Road B1F2, #2600 ! Ann Arbor, MI 48105-2785 ! http://rsug.itd.umich.edu/software/radmind ! ra...@um... ! */ #include <sys/param.h> #include <errno.h> #include <stdio.h> - #include <stdlib.h> #include <string.h> #include "code.h" --- 1,14 ---- /* ! * Copyright (c) 2003 Regents of The University of Michigan. ! * All Rights Reserved. See COPYRIGHT. ! */ ! #include "config.h" #include <sys/param.h> #include <errno.h> #include <stdio.h> #include <string.h> + #include <stdlib.h> #include "code.h" *************** *** 40,48 **** /* static */ static char buf[ 2 * MAXPATHLEN ]; ! char *temp; ! if ( strlen( line ) > MAXPATHLEN ) { ! fprintf( stderr, "ERROR: The path is too long\n" ); ! exit( 1 ); } --- 23,30 ---- /* static */ static char buf[ 2 * MAXPATHLEN ]; ! char *temp; ! if ( strlen( line ) > MAXPATHLEN ) { ! return( NULL ); } *************** *** 90,103 **** /* static */ static char buf[ MAXPATHLEN ]; ! char *temp; if ( strlen( line ) > ( 2 * MAXPATHLEN )) { ! fprintf( stderr, "ERROR: The path name is too long\n" ); ! exit( 1 ); } temp = buf; for ( ; *line != '\0'; line++, temp++ ) { switch( *line ) { case '\\': --- 72,89 ---- /* static */ static char buf[ MAXPATHLEN ]; ! char *temp, *end; if ( strlen( line ) > ( 2 * MAXPATHLEN )) { ! return( NULL ); } + end = buf + MAXPATHLEN; temp = buf; for ( ; *line != '\0'; line++, temp++ ) { + /* Check for buffer overflow - must have space for '\0' */ + if ( temp >= end ) { + return( NULL ); + } switch( *line ) { case '\\': Index: code.h =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/code.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** code.h 21 Oct 2002 22:18:25 -0000 1.1 --- code.h 12 Apr 2006 19:24:57 -0000 1.2 *************** *** 1,26 **** /* ! Copyright (c) 2002 Regents of The University of Michigan. ! All Rights Reserved. ! ! Permission to use, copy, modify, and distribute this software and ! its documentation for any purpose and without fee is hereby granted, ! provided that the above copyright notice appears in all copies and ! that both that copyright notice and this permission notice appear ! in supporting documentation, and that the name of The University ! of Michigan not be used in advertising or publicity pertaining to ! distribution of the software without specific, written prior ! permission. This software is supplied as is without expressed or ! implied warranties of any kind. ! ! Research Systems Unix Group ! The University of Michigan ! c/o Wesley Craig ! 4251 Plymouth Road B1F2, #2600 ! Ann Arbor, MI 48105-2785 ! ! http://rsug.itd.umich.edu/software/radmind ! ra...@um... ! */ ! char * encode( char * ); ! char * decode( char * ); --- 1,7 ---- /* ! * Copyright (c) 2003 Regents of The University of Michigan. ! * All Rights Reserved. See COPYRIGHT. ! */ ! char *encode( char * ); ! char *decode( char * ); |