Wireshark-bugs: [Wireshark-bugs] [Bug 5080] New: tvb_get_bits32 produces malformed_packet if no_

Date: Fri, 6 Aug 2010 04:36:57 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5080

           Summary: tvb_get_bits32 produces malformed_packet if no_of_bits
                    < 25 and tvb remaining = 3
           Product: Wireshark
           Version: 1.2.10
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: rodebiet@xxxxxxxxx


Build Information:
Version 1.2.10

Copyright 1998-2010 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.20.1, (32-bit) with GLib 2.24.1, with libpcap 1.0.0, with
libz 1.2.3.3, without POSIX capabilities, with libpcre 7.8, without SMI,
without
c-ares, without ADNS, with Lua 5.1, with GnuTLS 2.8.5, with Gcrypt 1.4.4, with
MIT Kerberos, without GeoIP, without PortAudio, without AirPcap.

Running on Linux 2.6.32-24-generic, with libpcap version 1.0.0, GnuTLS 2.8.5,
Gcrypt 1.4.4.

Built using gcc 4.4.3.
--
in function tvb_get_bits32 in file tvbuff.c.

if the remaining bytes in the tvb are 3 and no_of_bits < 25, then the
tvb_get_ntohl tries to read 4 bytes. This throws an ReportedBoundsError that
leads to a Malformed Packet.

the following solution works for tvb >= 4 bytes, but this would fail is the tvb
is only 3 bytes.

   if (no_of_bits < 25)
   {
      offset--;
      bit_offset += 8;
   }

the solution should not use tvb_get_ntohl but only tvb_get_unit8 for the 3 to 5
bytes that needs to be read.

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