fixed potential crasher in read algorithm (#347914)

* src/xfs.cc: fixed potential crasher in read algorithm (#347914)
This commit is contained in:
Bart Hakvoort 2006-07-19 17:26:42 +00:00
parent d37f1154d7
commit cf49d07996
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2006-07-19 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/xfs.cc: fixed potential crasher in read algorithm (#347914)
2006-07-18 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-07-18 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/GParted_Core.h, * include/GParted_Core.h,

View File

@ -80,8 +80,9 @@ void xfs::Set_Used_Sectors( Partition & partition )
S = -1 ; S = -1 ;
//free blocks //free blocks
output = output .substr( output .find( "fdblocks" ) ) ; index = output .find( "fdblocks" ) ;
if ( sscanf( output .c_str(), "fdblocks = %Ld", &N ) != 1 ) if ( index > output .length() ||
sscanf( output .substr( index ) .c_str(), "fdblocks = %Ld", &N ) != 1 )
N = -1 ; N = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )