Wireshark-bugs: [Wireshark-bugs] [Bug 1985] New: A bug in calculating the "Avg. packet size" sho

Date: Wed, 14 Nov 2007 06:28:55 +0000 (GMT)
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1985

           Summary: A bug in calculating the "Avg. packet size" shown in
                    Wireshark->Summary: Traffic: Avg. packet size
           Product: Wireshark
           Version: 0.99.6
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Trivial
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: smhuang@xxxxxxxxxxxxxxxxxxxx


Build Information:
Version 0.99.6a (SVN Rev 22276)

Copyright 1998-2007 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.10.12, with GLib 2.12.12, with WinPcap (version unknown),
with libz 1.2.3, with libpcre 6.4, with Net-SNMP 5.4, with ADNS, with Lua 5.1,
with GnuTLS 1.6.1, with Gcrypt 1.2.3, with MIT Kerberos, with PortAudio
PortAudio V19-devel, with AirPcap.

Running on Windows XP Service Pack 2, build 2600, with WinPcap version 4.0.1
(packet.dll version 4.0.0.901), based on libpcap version 0.9.5, without
AirPcap.

Built using Microsoft Visual C++ 6.0 build 8804

Wireshark is Open Source Software released under the GNU General Public
License.

Check the man page and http://www.wireshark.org for more information.
--
There is a bug in calculating the "Avg. packet size" shown in
Wireshark->Summary: Traffic: Avg. packet size.  There are unnecessary
parentheses that make the average packets size calculated is an integer instead
of a float.

A patch to fix this bug is attached below.


--- gtk/summary_dlg.c   2007-11-14 13:24:09.000000000 +0800
+++ gtk/summary_dlg.c   2007-11-14 13:23:53.000000000 +0800
@@ -307,7 +307,7 @@
   if (summary.packet_count > 0){
     g_snprintf(string_buff, SUM_STR_MAX, "%.3f bytes",
       /* MSVC cannot convert from unsigned __int64 to float, so first conve
rt to signed __int64 */
-      (float) (gint64) (summary.bytes/summary.packet_count) );
+      (float) (gint64) summary.bytes/summary.packet_count );
   } else {
     strcpy(string_buff, "");
   }


-- 
Configure bugmail: http://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.