Don't overflow from the gigabyte scale to the bit scale if the

number to auto-scale is >= 1024 Gb.  Could be triggered on arches
where ifdata counters had 64 bits.

Reported by:	Miroslav Slavkov on -net
MFC after:	3 days
This commit is contained in:
yar 2006-11-26 20:08:40 +00:00
parent e0945d6033
commit c8d29e02f4

View File

@ -69,7 +69,7 @@ get_tbl_ptr(const u_long size, const u_int scale)
* index as the array index into the conversion table.
*/
for (tmp = size, idx = SC_KILOBYTE;
tmp >= MEGA && idx <= SC_GIGABYTE;
tmp >= MEGA && idx < SC_GIGABYTE;
tmp >>= 10, idx++);
tbl_ptr = &convtbl[idx];