ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] Re: packet-pgsql.c changes in 0.10.9

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sat, 05 Mar 2005 19:15:07 -0800
Abhijit Menon-Sen wrote:

    guint32 l = tvb_get_ntohl( ... );

    if ( l > 0 && l < 1000000 )
        ...
    n += l;

And that last increment should be done only if l > 0.

If l is 0, "n += l" isn't a problem; the only problem is if l >= 1000000.

The right fix for that is to get rid of the test against 1000000, and to, instead, use "tvb_ensure_bytes_exist()" before dissecting - "tvb_ensure_bytes_exist()" doesn't give a special meaning to a negative length, it just assumes that a negative length really means "very large positive length" and throws the appropriate exception.

I've checked in a change to do that.