Update of /cvsroot/radmind/radmind
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18678
Modified Files:
root.c
Log Message:
Use >= MAXPATHLEN instead of > MAXPATHEN - 1.
Bounds checking in edge case.
Index: root.c
===================================================================
RCS file: /cvsroot/radmind/radmind/root.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** root.c 20 Jan 2006 21:27:27 -0000 1.6
--- root.c 15 Jan 2008 21:01:10 -0000 1.7
***************
*** 39,43 ****
if ( snprintf( test_path, MAXPATHLEN, "%s/tmp/transcript",
! radmind_real_path ) > MAXPATHLEN - 1 ) {
fprintf( stderr, "%s/tmp/transcirpt: path too long\n",
radmind_real_path );
--- 39,43 ----
if ( snprintf( test_path, MAXPATHLEN, "%s/tmp/transcript",
! radmind_real_path ) >= MAXPATHLEN ) {
fprintf( stderr, "%s/tmp/transcirpt: path too long\n",
radmind_real_path );
***************
*** 48,52 ****
if ( snprintf( file_root, MAXPATHLEN, "%s/tmp/file%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! > MAXPATHLEN - 1 ) {
fprintf( stderr, "%s/tmp/file%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path )] );
--- 48,52 ----
if ( snprintf( file_root, MAXPATHLEN, "%s/tmp/file%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! >= MAXPATHLEN ) {
fprintf( stderr, "%s/tmp/file%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path )] );
***************
*** 55,59 ****
if ( snprintf( tran_root, MAXPATHLEN, "%s/tmp/transcript%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! > MAXPATHLEN - 1 ) {
fprintf( stderr, "%s/tmp/transcript%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path )] );
--- 55,59 ----
if ( snprintf( tran_root, MAXPATHLEN, "%s/tmp/transcript%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! >= MAXPATHLEN ) {
fprintf( stderr, "%s/tmp/transcript%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path )] );
***************
*** 62,66 ****
} else {
if ( snprintf( test_path, MAXPATHLEN, "%s/transcript",
! radmind_real_path ) > MAXPATHLEN - 1 ) {
fprintf( stderr, "%s/transcript: path too long\n",
radmind_real_path );
--- 62,66 ----
} else {
if ( snprintf( test_path, MAXPATHLEN, "%s/transcript",
! radmind_real_path ) >= MAXPATHLEN ) {
fprintf( stderr, "%s/transcript: path too long\n",
radmind_real_path );
***************
*** 71,75 ****
if ( snprintf( file_root, MAXPATHLEN, "%s/file%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! > MAXPATHLEN - 1 ) {
fprintf( stderr, "%s/file%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path ) ]);
--- 71,75 ----
if ( snprintf( file_root, MAXPATHLEN, "%s/file%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! >= MAXPATHLEN ) {
fprintf( stderr, "%s/file%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path ) ]);
***************
*** 78,82 ****
if ( snprintf( tran_root, MAXPATHLEN, "%s/transcript%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! > MAXPATHLEN - 1 ) {
fprintf( stderr, "%s/transcript%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path )] );
--- 78,82 ----
if ( snprintf( tran_root, MAXPATHLEN, "%s/transcript%s",
radmind_real_path, &real_path[ strlen( test_path ) ])
! >= MAXPATHLEN ) {
fprintf( stderr, "%s/transcript%s: path too long\n",
radmind_real_path, &real_path[ strlen( test_path )] );
***************
*** 84,89 ****
}
} else {
! sprintf( file_root, "%s/../file", real_path );
! sprintf( tran_root, "%s", real_path );
}
}
--- 84,89 ----
}
} else {
! snprintf( file_root, MAXPATHLEN, "%s/../file", real_path );
! snprintf( tran_root, MAXPATHLEN, "%s", real_path );
}
}
|