Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2009 15:58:05 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Robert Watson <rwatson@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r198118 - head/usr.bin/netstat
Message-ID:  <20091016154905.E8438@delplex.bde.org>
In-Reply-To: <200910151031.n9FAVOvU070664@svn.freebsd.org>
References:  <200910151031.n9FAVOvU070664@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 15 Oct 2009, Robert Watson wrote:

> Log:
>  Print routing statistics as unsigned short rather than unsigned int,
>  otherwise sign extension leads to unlikely values when in the negative
>  range of the signed short structure fields that hold the statistics.
>  The type used to hold routing statistics is arguably also incorrect.

This enlarges the bug.  With signed types you get advance warning of
overflow (you actually get overflow earlier but it usually just results
in obviously wrong values being printed), and repeated warnings on
overflow (every time the overflowing values wrap back to negative).
With unsigned types or this change, you get unobviously wrong values
after the first overflow, and no repeated warnings (unless you watch
the values carefully enough to see them go backwards).  Using unsigned
bytes only delays the overflow for a whole factor of 2.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091016154905.E8438>