mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
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:
parent
779ebbf925
commit
bfab3622ec
@ -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()) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user