Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:42.2
iftop
001-Avoid-32-bit-overflow-for-rates-when-calcul...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 001-Avoid-32-bit-overflow-for-rates-when-calculating-bar.patch of Package iftop
http://lists.beasts.org/pipermail/iftop-users/2014-March/000414.html From: Hans Fugal <hans@fugal.net> Date: Fri, 7 Mar 2014 13:22:04 -0800 Subject: [PATCH 1/3] Avoid 32-bit overflow for rates when calculating bar length Avoid 32-bit overflow by using double instead of int. uint64_t would be another option but these are only ever used in conjunction with floats. (float was also an option) --- ui.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui.c b/ui.c index 57ca6c0..8a3b9d0 100644 --- a/ui.c +++ b/ui.c @@ -71,7 +71,8 @@ int dontshowdisplay = 0; /* Barchart scales. */ static struct { - int max, interval; + double max; + int interval; } scale[] = { { 64000, 10 }, /* 64 kbit/s */ { 128000, 10 }, @@ -105,7 +106,7 @@ static float get_max_bandwidth() { } /* rate in bits */ -static int get_bar_length(const int rate) { +static int get_bar_length(const double rate) { float l; if (rate <= 0) return 0;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor