From cf49d0799681a200558120bb2116a631b77908a1 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Wed, 19 Jul 2006 17:26:42 +0000 Subject: [PATCH] fixed potential crasher in read algorithm (#347914) * src/xfs.cc: fixed potential crasher in read algorithm (#347914) --- ChangeLog | 4 ++++ src/xfs.cc | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e399fae..3fd57fc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-07-19 Bart Hakvoort + + * src/xfs.cc: fixed potential crasher in read algorithm (#347914) + 2006-07-18 Bart Hakvoort * include/GParted_Core.h, diff --git a/src/xfs.cc b/src/xfs.cc index 80bf399e..58f2fb86 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -80,8 +80,9 @@ void xfs::Set_Used_Sectors( Partition & partition ) S = -1 ; //free blocks - output = output .substr( output .find( "fdblocks" ) ) ; - if ( sscanf( output .c_str(), "fdblocks = %Ld", &N ) != 1 ) + index = output .find( "fdblocks" ) ; + if ( index > output .length() || + sscanf( output .substr( index ) .c_str(), "fdblocks = %Ld", &N ) != 1 ) N = -1 ; if ( N > -1 && S > -1 )