fixed unlikely but possible invalid read in formatting of bandwidth numbers

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8492 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-06-16 14:18:09 +00:00
parent 779ebbf925
commit bfab3622ec

View File

@ -1927,7 +1927,7 @@ static std::string printFloatNumber(float num,bool friendly=false)
std::string units[4] = { "B/s","KB/s","MB/s","GB/s" } ; std::string units[4] = { "B/s","KB/s","MB/s","GB/s" } ;
int k=0 ; int k=0 ;
while(num >= 800.0f && k<5) while(num >= 800.0f && k<4)
num /= 1024.0f,++k; num /= 1024.0f,++k;
sprintf(tmp,"%3.2f %s",num,units[k].c_str()) ; sprintf(tmp,"%3.2f %s",num,units[k].c_str()) ;